These are chat archives for opal/opal

10th
Jun 2015
Forrest Chang
@fkchang
Jun 10 2015 01:26 UTC
@jaredcwhite submitted my opalist entry
Christian Käser
@dfyx
Jun 10 2015 09:07 UTC
@elia I found some other weird behavior with opal-jquery
Assume I have the following html: <span id="foobar" data-some-object="{'foo': 2}">...</span>
Now I run Element.find('#foobar').data('some-object')
jQuery parses the JSON and returns a JS object. opal-jquery doesn't wrap this object and just returns it
Adam Beynon
@adambeynon
Jun 10 2015 09:11 UTC
@dfyx yeah, its a bug. until now Element#data assumed it was either a string or numeric - it needs to check for js objects and wrap them in a hash
Christian Käser
@dfyx
Jun 10 2015 09:12 UTC
@adambeynon What's the best way to wrap an object in a hash? Couldn't find it in the documentation
Adam Beynon
@adambeynon
Jun 10 2015 09:12 UTC
@dfyx I think Hash.new(js_object) should do the trick
Christian Käser
@dfyx
Jun 10 2015 09:13 UTC
Ah, thanks
Appears to work
If I find the time later today, I'll send a pull request
Elia Schito
@elia
Jun 10 2015 09:14 UTC
:+1:
Christian Käser
@dfyx
Jun 10 2015 10:15 UTC
Alright, I got it: opal + raphael.js == pie charts in 50 lines of code
Mitch VanDuyn
@catmando
Jun 10 2015 13:13 UTC
does anybody know?
in 0.6 you could say get klass._proto but in 0.7.2 it seems like ._proto is no longer there... does anything replace it that I could grab?
Elia Schito
@elia
Jun 10 2015 13:20 UTC
@catmando it's $$proto now
that's because otherwise _proto was accessible as @_proto from the class instance
the same is true for other internal properties
Mitch VanDuyn
@catmando
Jun 10 2015 13:23 UTC
@elia, gotcha. so anything _foo became $$foo? Thanks
Elia Schito
@elia
Jun 10 2015 13:24 UTC
yep
Elia Schito
@elia
Jun 10 2015 14:19 UTC
@jaredcwhite props to the opalist sponsor!
Rick Carlino
@RickCarlino
Jun 10 2015 14:24 UTC
@jaredcwhite Yeah! I love having one place to get my Opal fix every week. Keep up the good work.
Elia Schito
@elia
Jun 10 2015 14:45 UTC
@ryanstout CFP for https://jsremoteconf.com seems open
Jared White
@jaredcwhite
Jun 10 2015 16:29 UTC
@elia Haha, well...the sponsor is me. :) More specifically, my newly branded consulting company. But maybe at some point I can get a sponsor or two elsewhere to help support the newsletter and other Opal-related projects. :)
@RickCarlino Thanks Rick! Every other week for now, but maybe down the road we can do every week when there's enough interesting news and I have enough time. :)
Srikanth Kuppuswamy
@Hospira-MedNet
Jun 10 2015 20:37 UTC
i am new to opal, i am looking something where i can call my existing ruby methods in a protractor test (.JS file).
when i read this page - http://opalrb.org/docs/compiled_ruby/ - Ruby from Javascript, so i have the class Foo in a ruby file.. how i need to make a call .JS file
can anyone help me
Elia Schito
@elia
Jun 10 2015 22:18 UTC
@Hospira-MedNet you an use the command line
opal -c foo.rb > foo.js
Srikanth Kuppuswamy
@Hospira-MedNet
Jun 10 2015 22:27 UTC
@elia, i called like you said in a terminal but no result..
Srikanth Kuppuswamy
@Hospira-MedNet
Jun 10 2015 22:32 UTC
i got some exceptions.. C:/Ruby/lib/ruby/gems/1.9.1/gems/opal-0.7.2/lib/opal/builder.rb:45:in `rescue in
build_str': A file required by "srikanth.rb" wasn't found. (Opal::Builder::Miss
ingRequire)
can't find file: "Opal" in ["C:/Ruby/lib/ruby/gems/1.9.1/gems/opal-0.7.2/opal",
"C:/Ruby/lib/ruby/gems/1.9.1/gems/opal-0.7.2/stdlib", "C:/Ruby/lib/ruby/gems/1.9
.1/gems/opal-0.7.2/lib"]
@elia can u help me on this
Elia Schito
@elia
Jun 10 2015 22:33 UTC
"""can't find file: "Opal" in """
are you trying to require Opal with the capital letter?
it should be opal (lowercase )
Srikanth Kuppuswamy
@Hospira-MedNet
Jun 10 2015 22:34 UTC
oh i have in the ruby file as require 'Opal'
Elia Schito
@elia
Jun 10 2015 22:35 UTC
That's the problem
Srikanth Kuppuswamy
@Hospira-MedNet
Jun 10 2015 22:35 UTC
i changed and executed now
now no exception but no result in terminal
Elia Schito
@elia
Jun 10 2015 22:36 UTC
It should have created a foo.js file
that you can use in your browser
gotta go
bye
Srikanth Kuppuswamy
@Hospira-MedNet
Jun 10 2015 22:37 UTC
oh elia whn u will be online again
plzz or let me know can i send an email to u.. with my doubts plzz
Srikanth Kuppuswamy
@Hospira-MedNet
Jun 10 2015 22:47 UTC
then when we will call like this - Opal.Foo.$new().$bar();
Elia Schito
@elia
Jun 10 2015 22:48 UTC
Write here or post a question on stack overflow with the tag opalrb
someone will reply ;)
Srikanth Kuppuswamy
@Hospira-MedNet
Jun 10 2015 22:50 UTC
so i read like we can make a call like above from javascript , how?
actually i need to use the available functions in ruby in protractor test which is in .JS file
when i say available functions which we have written already based on features
so i am looking one example where some methods available in ruby class. how i can call those methods from .JS file using opal
direct call from .JS file
Srikanth Kuppuswamy
@Hospira-MedNet
Jun 10 2015 22:56 UTC
@elia or anyone plz help me out on this