Class: Hash
- Inherits:
-
Object
- Object
- Hash
- Defined in:
- lib/js/hash.rb
Instance Method Summary collapse
-
#to_js ⇒ Object
Convert a hash to a JavaScript object.
Instance Method Details
#to_js ⇒ Object
Convert a hash to a JavaScript object
3 4 5 6 7 |
# File '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 |