Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 39f6d04c79

Fetching latest commit…

Cannot retrieve the latest commit at this time

..
Failed to load latest commit information.
store-after
store-before
README

README

RailsCasts Episode #297: Running JavaScript in Ruby

http://railscasts.com/episodes/297-running-javascript-in-ruby

Commands used in the Rails Console

  c = V8::Context.new
  c.eval('1 + 2')
  c[:num] = 3
  c.eval('num * num')
  c.eval('math = {square: function(n) { return n*n }}')
  c[:math].square(5)
  c[:square] = lambda { |n| n*n }
  c.eval('square(4)')
Something went wrong with that request. Please try again.