class RubyRunJs::GlobalScope

Attributes

builtin[R]
stack[R]
this_binding[RW]

Public Class Methods

new(builtin) click to toggle source
Calls superclass method RubyRunJs::JsBaseObject::new
# File lib/ruby_run_js/scope.rb, line 26
def initialize(builtin)
  super()
  @stack = []
  @builtin = builtin
end

Public Instance Methods

_class() click to toggle source
# File lib/ruby_run_js/scope.rb, line 32
def _class
  'Global'
end
create_binding(var_label) click to toggle source
# File lib/ruby_run_js/scope.rb, line 36
def create_binding(var_label)
  unless has_binding(var_label)
    define_own_property(var_label,
        {
          'value' => undefined,
          'configurable' => false,
          'writable' => true,
          'enumerable' => true
        },false)
  end
end
get_binding_value(var_label, throw = false) click to toggle source
# File lib/ruby_run_js/scope.rb, line 48
def get_binding_value(var_label, throw = false)
  if !has_binding(var_label) && throw
    raise make_error('ReferenceError', "#{var_label} is not defined")
  end
  get(var_label)
end