adambeynon 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 http://irclog.whitequark.org/opal
DrShoggoth has quit [Quit: Leaving]
elia has quit [Quit: Computer has gone to sleep.]
e_dub has quit [Ping timeout: 276 seconds]
e_dub has joined #opal
e_dub has quit [Quit: It's a hard knock life]
_whitelogger has joined #opal
e_dub has joined #opal
meh` has quit [Ping timeout: 246 seconds]
e_dub has quit [Ping timeout: 276 seconds]
e_dub has joined #opal
ryanstout has quit [Quit: ryanstout]
e_dub has quit [Ping timeout: 276 seconds]
e_dub has joined #opal
e_dub has quit [Ping timeout: 276 seconds]
e_dub has joined #opal
e_dub has quit [Ping timeout: 276 seconds]
e_dub has joined #opal
kludge` has quit [Ping timeout: 252 seconds]
kludge` has joined #opal
e_dub has quit [Ping timeout: 276 seconds]
e_dub has joined #opal
elia has joined #opal
elia has quit [Quit: Computer has gone to sleep.]
e_dub has quit [Ping timeout: 276 seconds]
e_dub has joined #opal
DouweM has quit [Ping timeout: 264 seconds]
meh` has joined #opal
elia has joined #opal
e_dub has quit [Ping timeout: 276 seconds]
e_dub has joined #opal
e_dub has quit [Ping timeout: 276 seconds]
e_dub has joined #opal
DouweM has joined #opal
elia has quit [Quit: Computer has gone to sleep.]
<dragonkh> hi
<dragonkh> im just reading the previous transcript about being able to use rubygems in opal - is this possible now?
<dragonkh> can I require a standard ruby gem for use with opal?
<meh`> dragonkh, you can, no assurance it will work
<meh`> actually, you've been able to do that for a looong while
<meh`> you just have to call Opal.use_gem
<meh`> and it will add the paths
GitHub56 has joined #opal
<GitHub56> [opalrb.org] adambeynon pushed 1 new commit to master: http://git.io/zkx6Sg
GitHub56 has left #opal [#opal]
<GitHub56> opalrb.org/master c4996cc Adam Beynon: Use data.yml for docs structure
e_dub has quit [Ping timeout: 276 seconds]
e_dub has joined #opal
e_dub has quit [Ping timeout: 276 seconds]
e_dub has joined #opal
e_dub has quit [Client Quit]
<dragonkh> meh: thanks for the info
<dragonkh> meh`: I'd not expect many of the ruby gems to actually work given the amount of dependencies many of them have
<meh`> dragonkh, well, as long as they don't depend on anything platform specific, they would work
<dragonkh> meh`: I'll have to experiment
<dragonkh> meh`: can I access the filesystem via opal e.g. write a file to the filesystem?
<dragonkh> meh`: when I'm running via a sprockets app I guess the code is running client side - so writing to the filesystem wont be permitted
<meh`> dragonkh, nope
<meh`> yeah, you can't
<meh`> that's platform specific
<meh`> threads are platform specific
marcandre has joined #opal
GitHub24 has joined #opal
GitHub24 has left #opal [#opal]
<GitHub24> [opal-jquery] adambeynon closed pull request #34: fix, return the status_code in http.rb (master...fix_status_code_on_http) http://git.io/taRPgA
GitHub176 has joined #opal
<GitHub176> [opal-jquery] adambeynon pushed 2 new commits to master: http://git.io/vtWF4g
<GitHub176> opal-jquery/master 80edeb1 Jan Svoboda: fix, return the status_code in http.rb
GitHub176 has left #opal [#opal]
<GitHub176> opal-jquery/master 7d3c228 Adam Beynon: Merge pull request #34 from svoboda-jan/fix_status_code_on_http...
wmnnd_ has joined #opal
<wmnnd_> Hey there, I a currently struggling to include opal-jquery in my project. require "opal-jquery" is only working an a .rb file that is converted to JS, when I also require opal-jquery in my conf.ru file.
<wmnnd_> Do you have any idea why that could be?
<adambeynon_> when you require it in your config.ru, you are requiring the lib/ directory
<adambeynon_> when you require it inside an opal .rb file, you are requiring the opal/ directory
<adambeynon_> lib/opal-jquery.rb basically adds opal/ to the opal load path
<meh`> adambeynon_, lib/opal-jquery.rb should really be lib/opal/jquery.rb
<meh`> or it won't work automatically with bundler
<meh`> had the same issue with opal-browser
<adambeynon_> meh`: yeh it is (I said opal-jquery as an example )
<adambeynon_> how it opal-browser going?
<adambeynon_> is*
<meh`> adambeynon_, pretty good
<meh`> fixed and improved delegated events
<meh`> should be a ton faster than before
<meh`> and easier to read
kings has joined #opal
<kings> hi
<kings> is there any docs explaining how to write tests for my opal code?
<wmnnd_> I'm trying to access some json that I have within a script tag that gets executed before I include my opal stuff. However, I can't seem to be able to access it via Nat)
<wmnnd_> *Native
<wmnnd_> I have var data = "Something" in that other script and Native(`data`) returns nil.
<meh`> kings, I don't think so
<meh`> kings, what kind of opal code is it?
<meh`> because there are few ways to do it
<meh`> wmnnd_, Hash.new(`data`)
<meh`> when you require 'native' Hash gets a new constructor
<kings> meh`: I have a set of classes which parse some json and build some objects from it - then render some html from the objects
<kings> meh`: so I wanted to both test the classes and also the html that is generated
<meh`> kings, in that case you don't need to run them in the browser
<meh`> kings, https://github.com/meh/lissio see this
<meh`> the Rakefile and spec/
<kings> meh`: shall I just require rspec and write some tests?
<meh`> yes
<meh`> wait, I think it's using opal-spec
<meh`> I don't know where I put the non-browser spec running example ◕ ◡ ◔
<meh`> adambeynon_, ^
<kings> meh`: oh lissio looks very cool - so does opal-browser !!
<meh`> :)
<kings> how long has opal been around? I'm sure I looked it at it a few years ago but it didnt seem very interesting then for some reason
<meh`> 3 years maybe?
<meh`> I joined 2 years ago I think
<wmnnd_> meh`: I need to include opal-native in order to use Native?
<meh`> vienna uses rspec
<meh`> wmnnd_, since 0.6, yes
<meh`> the native stuff has been moved to the stdlib
<meh`> just require 'native', it's in the stdlib
<meh`> I should really gank opal-native
<meh`> it's very old code
<meh`> before opal had native support
<meh`> and we didn't have stdlib at all
<kings> meh`: you have written some nice stuff !
<meh`> thanks
<kings> I've just written the json parsing so far - I haven't worked out how I will make the view yet
<kings> maybe lissio would be a nice way to bring it together
<meh`> kings, lissio already supports transforming JSON into models
<meh`> kings, https://github.com/meh/gwentoo see this
<meh`> it does a bunch of weird JSON parsing trickery to get it into models
<wmnnd_> Mhm ... 'm staring to think I should switch to JS for client side development again.
<meh`> wmnnd_, how so?
<kings> meh`: my json parsing is quite specific so I think I would still prefer to use my implementation
<wmnnd_> meh`: It's just frustrating to work with Opal without documentation.
<meh`> you can
ryanstout has joined #opal
<meh`> wmnnd_, adambeynon_ is working on more documentation for the next release
<meh`> I think the release is just waiting for the documentation at this point
<meh`> wmnnd_, but yeah, might be too soon, we aren't at 1.0 yet if you think about it :)
<kings> meh`: my first implementation of my code was in java - I used gson to parse the html - but now I have moved to a more functional programming style - so this is an experiment at going back to ruby but providing a client side only version
<kings> wmnnd_: I know what you mean! I've had to read lots of code and ask lots of questions!!
<meh`> in any case we're always here to answer questions
<kings> I feel a bit silly asking some of the questions as after I get the answer it seems really obvious lol
<meh`> documentation will take time
<meh`> also there's a lot of exampel code
<wmnnd_> kings: I agree.
<wmnnd_> meh`: But then you always have to ask yourself: "Did I miss something totally obvious in the example code?"
<kings> btw I'm also dragonkh - but I left myself logged in on the office computer
<kings> meh`: whats the main difference between vienna and lissio?
<kings> hmm maybe I should just hand code it for the experience this time
<meh`> wmnnd_, in that case you ask, opal is not finished yet, I agree the lacking documentation is an issue, but we're working on it
<meh`> kings, vienna is MVC
<meh`> kings, lissio is more web components
<kings> I think I want to build just a static js file - which generates the views based on the json file
<kings> there's not really much functionality - just a report based on the json - so probably a framework is overkil
<wmnnd_> I still haven't managed to get a JS string ito my opal application^^ This is what I've tried: http://pastebin.com/tSjz2Wr2
<kings> wmnnd_: oh I did that yesterday :)
<meh`> wmnnd_, yours is a javascript problem
<meh`> window.data = "something"
<meh`> var has local scope to the script block
<wmnnd_> Does it? I have tried to rule this out by using another script block and trying to access it from there - that worked fine.
<wmnnd_> It also worked from a function from another script block.
<meh`> in any case
<meh`> you don't need to make strings into native
<meh`> strings are bridged
<kings> I found that using opal-jquery is much easier - as it returns a ruby object - otherwise if using native it has to be wrapped in a Native
<kings> e.g. a = `$('body') ; p a => Element [<body>]
<meh`> yeah, using the DOM or anything browser related with just native is madness
<wmnnd_> Actually, I want JSON/A Hash, not a string. I just started with a string for simplicity^^ What solution do you suggest there? I've been thinking it might be the easiest to have the JSON as a string and then parse it with JSON.parse from the Opal application. What would you suggest?
<kings> a = Native(`document.getElementById('someid')`)
<meh`> wmnnd_, define JSON
<meh`> are you talking about a JS object?
<meh`> to me JSON is the encoding
<meh`> kings, actually
<meh`> $$.document.getElementById('someid')
<wmnnd_> That is what it is to me. A way to transport a Hash from my server-side application to the client side.
<kings> I grab my json with: Http.get('some.json') then use response.json to get the json
<meh`> wmnnd_, require 'json'
<meh`> JSON.parse(myjsonstring)
<kings> sorry that wasnt clear - Http.get('some.json'){|response| json = reponse.json }
<wmnnd_> Okay, that's what I did^^
kings has quit [Quit: Leaving...]
<wmnnd_> But I still haven't managed to get the string. Now my script says: window.data = "{...}". But how do I access it from Opal?
<meh`> JSON.parse(`window.data`)
<meh`> JSON.parse($$.data)
<meh`> your choie
<meh`> *choice
<wmnnd_> meh`: Awesome!
<wmnnd_> Now it seems obvious.
<wmnnd_> Just like kings said^^
<meh`> the obvious things are the hardest to document
<meh`> because they're obvious to us
ryanstout has quit [Quit: ryanstout]
ryanstout has joined #opal