Class: Kalc::Ast::NonOps
- Inherits:
-
Object
- Object
- Kalc::Ast::NonOps
- Defined in:
- lib/kalc/ast.rb
Instance Attribute Summary collapse
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
- #eval(context) ⇒ Object
-
#initialize(value) ⇒ NonOps
constructor
A new instance of NonOps.
Constructor Details
#initialize(value) ⇒ NonOps
Returns a new instance of NonOps.
108 109 110 |
# File 'lib/kalc/ast.rb', line 108 def initialize(value) @value = value end |
Instance Attribute Details
#value ⇒ Object (readonly)
Returns the value of attribute value.
106 107 108 |
# File 'lib/kalc/ast.rb', line 106 def value @value end |
Instance Method Details
#eval(context) ⇒ Object
112 113 114 |
# File 'lib/kalc/ast.rb', line 112 def eval(context) Arithmetic.new(@value.left.eval(context), @value.right.eval(context), @value.operator).eval(context) end |