Method: JavaScript::Scope#initialize

Defined in:
lib/javascript.rb

#initialize(parent = nil, target = nil, locals = {}) ⇒ Scope

Returns a new instance of Scope.



164
165
166
167
168
169
170
171
172
173
174
# File 'lib/javascript.rb', line 164

def initialize(parent = nil, target = nil, locals = {})
  @parent = parent
  @global = parent ? parent.__global__ : GlobalObject.new
  @locals = locals

  if Scope === target
    @target = target.__target__
  else
    @target = target || global
  end
end