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.
107 108 109 |
# File 'lib/kalc/ast.rb', line 107 def initialize(value) @value = value end |
Instance Attribute Details
#value ⇒ Object (readonly)
Returns the value of attribute value.
105 106 107 |
# File 'lib/kalc/ast.rb', line 105 def value @value end |
Instance Method Details
#eval(context) ⇒ Object
111 112 113 |
# File 'lib/kalc/ast.rb', line 111 def eval(context) Arithmetic.new(@value.left.eval(context), @value.right.eval(context), @value.operator).eval(context) end |