Class: Keisan::AST::ConstantLiteral
Instance Method Summary
collapse
Methods inherited from Node
#!, #%, #&, #*, #**, #+, #+@, #-, #-@, #/, #<, #<=, #>, #>=, #^, #and, #coerce, #deep_dup, #differentiate, #equal, #evaluate_assignments, #evaluated, #false?, #not_equal, #or, #replace, #simplified, #simplify, #to_cell, #to_node, #true?, #unbound_functions, #unbound_variables, #value, #well_defined?, #|, #~
Instance Method Details
#==(other) ⇒ Object
8
9
10
11
12
13
14
15
|
# File 'lib/keisan/ast/constant_literal.rb', line 8
def ==(other)
case other
when ConstantLiteral
value == other.value
else
false
end
end
|
#evaluate(context = nil) ⇒ Object
4
5
6
|
# File 'lib/keisan/ast/constant_literal.rb', line 4
def evaluate(context = nil)
self
end
|
#to_s ⇒ Object
17
18
19
20
21
22
23
24
|
# File 'lib/keisan/ast/constant_literal.rb', line 17
def to_s
case value
when Rational
"(#{value.to_s})"
else
value.to_s
end
end
|