Class: EleetScript::MethodContext

Inherits:
BaseContext show all
Defined in:
lib/lang/runtime/context.rb

Instance Attribute Summary

Attributes inherited from BaseContext

#constants, #current_class, #current_self, #global_vars, #local_vars, #namespaces

Instance Method Summary collapse

Methods inherited from BaseContext

#[], #[]=, #class_vars, #es_nil, init_with, #initialize, #instance_vars, #local_constant, #method_missing, #respond_to_missing?, #root_ns

Constructor Details

This class inherits a constructor from EleetScript::BaseContext

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class EleetScript::BaseContext

Instance Method Details

#local_var(name, value = nil) ⇒ Object



283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
# File 'lib/lang/runtime/context.rb', line 283

def local_var(name, value = nil)
  if value
    if @lambda_context && (val = @lambda_context.local_var(name))
      @lambda_context.local_var(name, value)
    else
      local_vars[name] = value
    end
  else
    val = super
    if val == es_nil && @lambda_context
      @lambda_context.local_var(name)
    elsif val
      val
    else
      es_nil
    end
  end
end

#namespace_contextObject



302
303
304
# File 'lib/lang/runtime/context.rb', line 302

def namespace_context
  @parent_context.namespace_context
end