Module: Less::JavaScript

Defined in:
lib/nashorn/rhino/less.rb

Defined Under Namespace

Classes: NashornContext

Class Method Summary collapse

Class Method Details

.to_js_hash(hash) ⇒ Object

TODO this needs to be figured out



79
80
81
82
83
84
85
# File 'lib/nashorn/rhino/less.rb', line 79

def self.to_js_hash(hash) # TODO this needs to be figured out
  # we can not pass wrapped Ruby Hash objects down as they won't
  # have a prototype (and thus no hasOwnProperty)
  js_hash = Nashorn.eval_js '({})'
  hash.each { |key, val| js_hash[key] = val }
  js_hash
end