Class: Keisan::AST::Variable
- Defined in:
- lib/keisan/ast/variable.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
-
#initialize(name) ⇒ Variable
constructor
A new instance of Variable.
- #value(context = nil) ⇒ Object
Constructor Details
#initialize(name) ⇒ Variable
Returns a new instance of Variable.
6 7 8 |
# File 'lib/keisan/ast/variable.rb', line 6 def initialize(name) @name = name end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
4 5 6 |
# File 'lib/keisan/ast/variable.rb', line 4 def name @name end |
Instance Method Details
#value(context = nil) ⇒ Object
10 11 12 13 |
# File 'lib/keisan/ast/variable.rb', line 10 def value(context = nil) context = Keisan::Context.new if context.nil? context.variable(name) end |