Questions tagged [opalrb]

Opal is a Ruby to JavaScript source-to-source compiler. It comes packed with the Ruby corelib you know and love. It is both fast as a runtime and small in its footprint.

Opal is a Ruby to JavaScript compiler. It is source-to-source, making it fast as a runtime. Opal includes a compiler (which can be run in any browser), a corelib and runtime implementation. The corelib/runtime is also very small.

Opal is hosted on github, discussed on Gitter, has a Freenode IRC channel at #opal and is on twitter @opalrb.

More documentation can be found in the docs.

92 questions
0
votes
1 answer

Opal rb eval method throws 'undefined method'

Doesn't Opal.rb have an eval method? Using eval both in classes and outside throws undefined method 'eval' Everything else works fine.
ClassyPimp
  • 715
  • 7
  • 20
0
votes
1 answer

rails-opal and opal ujs on remote: true

I use rails-opal, opal-jquery gems, also require opal-ujs in application.js.rb, BUT on for example link_to "Foo", some_path, remote:true if I render e.g. remote_reply.js.rb layout:false with puts HI that code is not executed on client. If I send…
ClassyPimp
  • 715
  • 7
  • 20
0
votes
1 answer

Opal is completely broken?

I've been totally unsuccessful in getting Opal to work. When I try to embed it in a Sinatra server using the tutorial here or the example code here, I get undefined method 'source_maps' for #. When I use the updated code…
Sod Almighty
  • 1,768
  • 1
  • 16
  • 29
0
votes
1 answer

Opal.rb anonymous function in native object

Is it possible to somehow achieve methods/lambda assigned in Hash to compile to native functions in native object? for example let x = {foo: "foo", bar: ->{"bar"}} I need that x to be compiled like such native object: pseudo x.to_n => Object {foo:…
ClassyPimp
  • 715
  • 7
  • 20
0
votes
1 answer

How to use Opal-JQuery AJAX to Post / Get values

I'm attempting to post values to a server using opal-jquery and I'm not having much success. If I attempt a post I don't get anything back. A Get gives me the values in a less than useful string. Here is the console output from the browser: [Log]…
tsugua
  • 197
  • 1
  • 13
0
votes
1 answer

reset react.js between tests

I am using React.rb (a opal-ruby binding to react.js) and Opal-rspec for testing. It seems like I need to reset react's internals between tests as I am getting the awful "Cannot read property ‘firstChild’ of undefined" error, in some tests. If I…
Mitch VanDuyn
  • 2,838
  • 1
  • 22
  • 29
0
votes
1 answer

Event Complete Callbacks with Opal-jQuery

I am working on a project that handles multiple jQuery events in succession using the opal-jquery wrapper. jQuery has very effective callback functionality and I am wondering if it is possible to do this in pure ruby with Opal.
rpb
  • 87
  • 1
  • 8
0
votes
1 answer

How to use jquery libraries with opal-jquery?

So I'm using opal, opal-jquery, and jquery.terminal. The latter adds a function to jquery called terminal(). However Element doesn't seem to have that method?
krainboltgreene
  • 1,841
  • 2
  • 17
  • 25
0
votes
1 answer

referencing opal templates in specs

I have some working opal code running inside of a sample rails app, and I am trying to write some rspec tests around it. Everything is setup and I can do some basic stuff, but in my code I use templates, and I can't seem to get the load paths set up…
Mitch VanDuyn
  • 2,838
  • 1
  • 22
  • 29
0
votes
1 answer

Opal loads in Chrome but not in Node (ReferenceError: Opal is not defined)

For example, if I just run the following: node opal.min.js The result is: /home/benjamin/workspace/1/opal.min.js:1 klass){return obj.toString()}else{return obj.$inspect()}})}(self)})(Opal);(fun …
Ten Bitcomb
  • 2,316
  • 1
  • 25
  • 39
0
votes
2 answers

How shall I migrate to opal 0.7.0.beta

I tried to upgrade to use Opal 0.7.0.beta. I want to compile to a static app and follow the steps in http://opalrb.org/docs/static_applications/ My Rakefile looks like the one below. The questions: How do I need to rework the :build task to get rid…
Bernhard
  • 686
  • 8
  • 20
0
votes
1 answer

Capybara specs fails after opal js update?

Previously I used to load opal.js, opal-parser.js, opal-jquery.js(version 0.3x). Now I added gem opal and opal-rails(version 0.6.2) instead of js files. Previously my whole test suit(capybara + rspec) used to passed but after update capybara specs…
cmthakur
  • 2,266
  • 4
  • 18
  • 23
0
votes
1 answer

Opal ruby (opal-build) to transform nwn-lib (nwn-gff) to javascript? Lost

I'm trying to familiarize myself with both ruby and javascript through a hobby project to create a conversation editor (perhaps a google drive app) that shares i/o formats compatible with Neverwinter Nights (ergo https://github.com/niv/nwn-lib). I…
bladeo
  • 27
  • 4
0
votes
1 answer

how can i store/retrieve files in owncloud from a webapp written in opal/ruby?

I have a webapp written mostly in ruby compiled with opal. I now would like to store/retrieve file in my owncloud, maybe using WebDAV. I am looking for an example how to do this using HTTP module. I tried HTTP.get("https://owncloud/foo.abc") do…
Bernhard
  • 686
  • 8
  • 20
0
votes
1 answer

Languages compiling/interpreting to Javascript (such as Ruby/Python/Coffescript)

Newbie self-learner diving into web development here. My goal is to learn how to build web-apps. Three quick questions: Ruby and Python seem to have offshoots that compile their respective code to Javascript (i.e. Opal/Pyjamas). If I can get…
pgh
  • 3
  • 2