meh` changed the topic of #opal to: http://opalrb.org - Ruby runtime and library on top of Javascript | 1.0.0 is near | This channel is logged at https://botbot.me/freenode/opal/
j_mcnally has quit [Ping timeout: 260 seconds]
e_dub has joined #opal
j_mcnally has joined #opal
ryanstout has joined #opal
ryanstout has quit [Quit: ryanstout]
j_mcnally has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
stnly has quit [Ping timeout: 246 seconds]
stnly has joined #opal
elia has joined #opal
wmnnd has joined #opal
dbackeus has joined #opal
<dbackeus> hi, I'm absolutely new to opal and fiddling about with it
<dbackeus> it seems I'm in a bit of an unusual position as Opal appears to take for given that you're using it from a ruby project
<dbackeus> but I'm trying to use it in a Meteor project using opal to compile ruby files into javascript
<dbackeus> I've got it working, but I have no clue how to work with packages
<dbackeus> would be nice even to get opals stdlib working to begin with
<dbackeus> then move on to opal-browser if possible
<dbackeus> the opal docs just talk about compiling corelib into js but what about stdlib?
<elia> dbackeus, you can use the CDN: http://cdn.opalrb.org
<elia> dbackeus, but I'm interested in your ideal setup for this situation, maybe we can make it happen
<dbackeus> haha, my ideal is to write javascript apps with ruby I guess, might be too early for me to describe details since I'm still in the process of figuring out the limitations of opal etc
<elia> Personally though, even in node-webkit projects, I set up a rake task to build stuff statically
<elia> dbackeus, well, you can also include opal-parser.js and use it right in the browser with <sctipt type="text/ruby">
<elia> let me fetch a blog post I wrote
<adambeynon> I saw a blog post about using meteor + opal a while back
<elia> dbackeus, can't find it, but this is the gist of it https://gist.github.com/elia/bf389b89e35618ad2221
<elia> adambeynon, topic change: do you mind sharing your angularjs adapter?
<dbackeus> cool stuff
<elia> :)
<dbackeus> I'll mess about some more, good to know there are people to talk to :)
<adambeynon> elia: sure, its not very stable though
<elia> dbackeus, +1, give feedback anytime, especially on usability and docs (PRs are also well accepted)
<adambeynon> Im back in the "I hate angular" camp now though after it
<adambeynon> I find their setup really awkward to deal with
<adambeynon> $and $I $hate $their $variable $naming
<elia> adambeynon, lol, it's good as it is, just wanted to rewrite my colleague app from this post: http://dev.mikamai.com/post/97732414859/the-rails-angular-equation-can-give-you-satisfaction
<elia> adambeynon, my gut always told me not to trust angular
<adambeynon> the basics of angular I like, dom attributes for bindings etc, its just all the other crap I dont like. I copied their dom bindings idea, and thats what I use now in my opal apps
<adambeynon> (finding link)
<adambeynon> but yeah, Ill post the code I've done so far
<adambeynon> it works to a degree, but involves a lot of hacky to get ruby objects as controllers
<elia> adambeynon, sounds like fun, should be enough tho for my mean purposes :P
* elia is going to have lunch
<adambeynon> elia: Im struggling to get any form of require_tree() working with opal
<adambeynon> (that works nicely with sprockets)
meh` has joined #opal
wmnnd has quit [Ping timeout: 260 seconds]
<dbackeus> according to the documentation on Native: http://opalrb.org/docs/interacting_with_javascript/
<dbackeus> you can set properties with [:something] = "something"
<dbackeus> but when I try that I get Object w has no method '$[]='
<dbackeus> actually even getting properties appears broken
<dbackeus> when trying to puts window["location"] I just get "w"
<dbackeus> generated code looks ok:
<dbackeus> window = self.$Native("window");
<dbackeus> self.$puts(window['$[]']("location"));
<dbackeus> oh, turns out I missed that I'm supposed to use backticks for the argument to Native(), never mind
<dbackeus> what's the opal equivalent of a basic javascript object?
<dbackeus> if I do {} in opal I get a hash object
<elia> adambeynon, what's the issue you're encountering?
<elia> dbackeus, Hash.new.to_n gives you the corresponding literal object
<dbackeus> right, thanks
<elia> dbackeus, of course all keys become strings
<dbackeus> makes sense
wmnnd has joined #opal
dbackeus has quit [Ping timeout: 246 seconds]
dbackeus has joined #opal
<dbackeus> can make new instances of native objects?
<dbackeus> was trying to do
<dbackeus> Collection = Native("Meteor.Collection")
<dbackeus> Posts = Collection.new("posts")
<dbackeus> but there is no .new method on the native object
<meh`> dbackeus, Native(`new Meteor.Collection`)
<dbackeus> thanks, this seems to be the proper way of thinking about it:
<meh`> dbackeus, you can do class bridging like jquery does
<meh`> I mean, opal-jquery
<meh`> ask elia about it
<elia> dbackeus, ask me anything (no, not really) :)
<dbackeus> elia, do you have an example of this class bridging I can look at?
<elia> dbackeus, yes, opal-jquery itself is a pretty good example
<elia> e.g. alias_native is provided by native.rb for bridged classes to expose js methods: https://github.com/opal/opal-jquery/blob/master/opal/opal-jquery/element.rb#L65-L74
<dbackeus> so a bridged class is an opal class that inherits from a javascript class?
<meh`> dbackeus, yes
<meh`> basically at least
<meh`> it does some magical things to make it work
<dbackeus> magic I don't mind
<dbackeus> ;)
<adambeynon> volt made it into this week's Ruby Weekly..
<meh`> noice
davispuh has joined #opal
<dbackeus> don't really understand about bridged classes
<dbackeus> found a bridged classes spec in the opal source but don't know where to find the implementation
<dbackeus> from the spec it looked like the original javascript class needs to be defined in an opal style, ie methods should be prefixed by $ etc
<dbackeus> elia, and advice on the above?
elia has quit [Quit: Computer has gone to sleep.]
elia has joined #opal
<elia> dbackeus, let me see
<elia> dbackeus, you need to explicitly and selectively expose native methods
<elia> e.g.:
<elia> class Collection < `Meteor.Collection`
<elia> alias_native :ruby_side_name, :js_side_name
<elia> end
<elia> dbackeus, you may also want to override self.new to pass arguments to the original constructor
<elia> first thing it does is calling allocate which calls the js-side constructor
e_dub has quit [Quit: ZZZzzz…]
elia has quit [Quit: Computer has gone to sleep.]
elia has joined #opal
elia has quit [Client Quit]
elia has joined #opal
e_dub has joined #opal
fkchang has joined #opal
DrShoggoth has joined #opal
<dbackeus> Trying to find a way to avoid backticks in this scenario: https://gist.github.com/dbackeus/a00e4292810393438611
<dbackeus> I just need it to compile to "this." but neither self nor @ seem to work
<dbackeus> elia?
<elia> dbackeus, will give a look at it this evening (in some hours)
<dbackeus> cool!
<dbackeus> if you need it the implementation of map on the router is fairly simple: https://github.com/EventedMind/iron-router/blob/devel/lib/router.js#L224
<dbackeus> basically just call the method passed in with "this" set to the router itself
wmnnd has quit [Ping timeout: 260 seconds]
StephenA1 has joined #opal
StephenA1 has quit [Client Quit]
elia has quit [Quit: Computer has gone to sleep.]
dbackeus has quit [Ping timeout: 246 seconds]
dbackeus has joined #opal
dbackeus has quit [Ping timeout: 246 seconds]
elia has joined #opal
elia has quit [Client Quit]
j_mcnally has joined #opal
elia has joined #opal
elia has quit [Quit: Computer has gone to sleep.]
elia has joined #opal
elia has quit [Quit: Computer has gone to sleep.]
DrShoggoth has quit [Quit: Leaving]
DrShoggoth has joined #opal
elia has joined #opal
Thijsc has joined #opal
Thijsc has quit [Client Quit]
Thijsc has joined #opal
Thijsc has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
e_dub has quit [Quit: ZZZzzz…]
elia has quit [Quit: Computer has gone to sleep.]
adambeynon has quit [Ping timeout: 260 seconds]
dbackeus has joined #opal
adambeynon has joined #opal
GitHub175 has joined #opal
<GitHub175> [opal] elia pushed 1 new commit to master: http://git.io/LrTXHg
<GitHub175> opal/master d34f42f Elia Schito: Merge pull request #595 from opal/elia/runtime-naming...
GitHub175 has left #opal [#opal]
travis-ci has joined #opal
<travis-ci> [travis-ci] opal/opal#1979 (master - d34f42f : Elia Schito): The build passed.
<travis-ci> [travis-ci] Build details : http://travis-ci.org/opal/opal/builds/35675133
travis-ci has left #opal [#opal]
dbackeus has quit [Ping timeout: 246 seconds]
wmnnd has joined #opal
DrShoggoth has quit [Quit: Leaving]
elia has joined #opal
meh` has quit [Quit: I don't want to live on this planet anymore.]
elia has quit [Quit: Computer has gone to sleep.]
wmnnd has quit [Ping timeout: 258 seconds]
davispuh has quit [Ping timeout: 245 seconds]
fkchang has quit [Ping timeout: 246 seconds]