Class: Kalc::Ast::Positive
- Inherits:
-
Object
- Object
- Kalc::Ast::Positive
- Defined in:
- lib/kalc/ast.rb
Overview
Does nothing. For compat.
Instance Attribute Summary collapse
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
- #eval(context) ⇒ Object
-
#initialize(value) ⇒ Positive
constructor
A new instance of Positive.
Constructor Details
#initialize(value) ⇒ Positive
Returns a new instance of Positive.
56 57 58 |
# File 'lib/kalc/ast.rb', line 56 def initialize(value) @value = value end |
Instance Attribute Details
#value ⇒ Object (readonly)
Returns the value of attribute value.
54 55 56 |
# File 'lib/kalc/ast.rb', line 54 def value @value end |
Instance Method Details
#eval(context) ⇒ Object
60 61 62 63 64 65 66 |
# File 'lib/kalc/ast.rb', line 60 def eval(context) begin +(@value.eval(context)) rescue @value.eval(context) end end |