Class: Kalc::Ast::Positive

Inherits:
Object
  • Object
show all
Defined in:
lib/kalc/ast.rb

Overview

Does nothing. For compat.

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#valueObject (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