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.



56
57
58
# File 'lib/kalc/ast.rb', line 56

def initialize(value)
  @value = value
end

Instance Attribute Details

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