Class: AjLisp::AtConstantAtom
- Defined in:
- lib/ajlisp/at_constant_atom.rb
Instance Attribute Summary collapse
-
#constant ⇒ Object
readonly
Returns the value of attribute constant.
Attributes inherited from NamedAtom
Instance Method Summary collapse
- #evaluate(context) ⇒ Object
-
#initialize(name) ⇒ AtConstantAtom
constructor
A new instance of AtConstantAtom.
Methods inherited from NamedAtom
Constructor Details
#initialize(name) ⇒ AtConstantAtom
Returns a new instance of AtConstantAtom.
7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/ajlisp/at_constant_atom.rb', line 7 def initialize(name) super(name) @constant = name[1,name.length] words = @constant.split("::") @symbols = [] words.each do |word| @symbols.push word.intern end end |
Instance Attribute Details
#constant ⇒ Object (readonly)
Returns the value of attribute constant.
5 6 7 |
# File 'lib/ajlisp/at_constant_atom.rb', line 5 def constant @constant end |
Instance Method Details
#evaluate(context) ⇒ Object
19 20 21 22 23 24 25 26 27 |
# File 'lib/ajlisp/at_constant_atom.rb', line 19 def evaluate(context) result = Object @symbols.each do |symbol| result = result.const_get symbol end return result end |