Class: Hash

Inherits:
Object
  • Object
show all
Defined in:
ext/js/lib/js/hash.rb

Instance Method Summary collapse

Instance Method Details

#to_jsObject

Convert a hash to a JavaScript object



3
4
5
6
7
# File 'ext/js/lib/js/hash.rb', line 3

def to_js
  new_object = JS.eval("return {}")
  self.each { |key, value| new_object[key] = value }
  new_object
end