Method: Rhino::Context#open

Defined in:
lib/rhino/context.rb

#open(&block) ⇒ Object

Enter this context for operations. Some methods such as eval() will fail unless the context is open.



251
252
253
254
255
256
257
258
259
260
# File 'lib/rhino/context.rb', line 251

def open(&block)
  do_open(&block)
rescue JS::RhinoException => e
  if code_generation_error?(e)
    Rhino.warn "[INFO] Rhino byte-code generation failed forcing #{@native} into interpreted mode"
    self.optimization_level = -1
    retry
  end
  raise Rhino::JSError.new(e)
end