Class: CouchShell::EvalContext

Inherits:
BasicObject
Includes:
Kernel
Defined in:
lib/couch-shell/eval_context.rb

Instance Method Summary collapse

Constructor Details

#initialize(vardict) ⇒ EvalContext

Returns a new instance of EvalContext.



30
31
32
# File 'lib/couch-shell/eval_context.rb', line 30

def initialize(vardict)
  @_vardict = vardict
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(msg, *args) ⇒ Object



34
35
36
37
38
39
40
# File 'lib/couch-shell/eval_context.rb', line 34

def method_missing(msg, *args)
  if args.empty?
    @_vardict.lookup_var msg.to_s
  else
    raise ShellUserError, "unexpected syntax at #{msg}"
  end
end