Class: AjLisp::NamedAtom
- Inherits:
-
Object
show all
- Defined in:
- lib/ajlisp/named_atom.rb
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
#initialize(name) ⇒ NamedAtom
Returns a new instance of NamedAtom.
7
8
9
10
11
12
13
14
15
|
# File 'lib/ajlisp/named_atom.rb', line 7
def initialize(name)
if name.is_a? String
@name = name.intern
elsif name.is_a? Symbol
@name = name
else
raise "Name of Atom should be an String or Sysmbol"
end
end
|
Instance Attribute Details
#name ⇒ Object
Returns the value of attribute name.
5
6
7
|
# File 'lib/ajlisp/named_atom.rb', line 5
def name
@name
end
|
Instance Method Details
#evaluate(context) ⇒ Object
17
18
19
|
# File 'lib/ajlisp/named_atom.rb', line 17
def evaluate(context)
return context.getValue(@name)
end
|
#isEqualTo(atom) ⇒ Object
25
26
27
28
29
30
31
|
# File 'lib/ajlisp/named_atom.rb', line 25
def isEqualTo(atom)
if !atom.is_a? NamedAtom
return false
end
return @name == atom.name
end
|
#to_s ⇒ Object
21
22
23
|
# File 'lib/ajlisp/named_atom.rb', line 21
def to_s
return @name.to_s
end
|