<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.
<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
<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