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.
55 56 57 |
# File 'lib/kalc/ast.rb', line 55 def initialize(value) @value = value end |
Instance Attribute Details
#value ⇒ Object (readonly)
Returns the value of attribute value.
53 54 55 |
# File 'lib/kalc/ast.rb', line 53 def value @value end |
Instance Method Details
#eval(context) ⇒ Object
59 60 61 62 63 64 65 |
# File 'lib/kalc/ast.rb', line 59 def eval(context) begin +(@value.eval(context)) rescue @value.eval(context) end end |