views:

113

answers:

2

I'm working on a piece of logic that I would like to express on the server as well as in the browser. Something like validating a form where there must be certain logical relationships between the elements based on what has already been entered.

So... If I can write the logic once and somehow end up with both Ruby and with Javascript, I can write the logic just once and not have to worry about making sure that two pieces of code written in different languages have the same functional behaviour.

I don't need to reproduce everything in Ruby, obviously, and one simplification might be to port a single general-purpose library like Functional Javascript to Ruby.

Does anyone have experience with RubyJS? Can anyone point me to an existing project using RubyJS? Are there alternatives I should consider? Thanks in advance...

+3  A: 

I know about http://hotruby.yukoba.jp/ but have never used it

Matthew
This is very definitely a different approach to solving the problem. Very interesting, thanks.
raganwald
+1  A: 

I recently heard about a project named "Johnson" which embeds the Spidermonkey JavaScript interpreter inside Ruby. http://github.com/jbarnette/johnson

You could then eval some javascript inside ruby.

glenn jackman