Class: AjLisp::Context
- Inherits:
-
Object
- Object
- AjLisp::Context
- Defined in:
- lib/ajlisp/context.rb
Instance Method Summary collapse
- #getValue(name) ⇒ Object
-
#initialize(parent = nil) ⇒ Context
constructor
A new instance of Context.
- #setValue(name, value) ⇒ Object
Constructor Details
#initialize(parent = nil) ⇒ Context
Returns a new instance of Context.
5 6 7 8 |
# File 'lib/ajlisp/context.rb', line 5 def initialize(parent = nil) @parent = parent @values = Hash.new end |
Instance Method Details
#getValue(name) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/ajlisp/context.rb', line 10 def getValue(name) if @values.has_key?(name) return @values[name] end if @parent != nil return @parent.getValue(name) end return nil end |
#setValue(name, value) ⇒ Object
22 23 24 |
# File 'lib/ajlisp/context.rb', line 22 def setValue(name, value) @values[name] = value end |