Whether you would be able to call methods on it depends on whether the Snarl author did some (trivial) code magic or not, but it's certainly doable too.
Still I have no idea why would you want javascript in ruby in the first place.
With a stub DOM and Javascript interpreter, you can pass generated output from web application views directly into your testing environment and make assertions about the resulting behavior, dynamically-generated DOM nodes, etc.
There are a number of projects similar to this one (for which, sadly, I cannot currently pull up any bookmarks) mostly intended for a similar set of tasks. Being able to bring RSpec or Cucumber to bear on a hairy JS testing job can make the process much more enjoyable.
As for using Javascript from Ruby, it might be quite nice as a language to let your users write extensions and plugins. It's a language where the implementations all have an emphasis on sandboxing.
context.put(“rubyObject”, MyRubyClass.new)
Whether you would be able to call methods on it depends on whether the Snarl author did some (trivial) code magic or not, but it's certainly doable too.
Still I have no idea why would you want javascript in ruby in the first place.