class TTFunk::Sum
Sum
aggreaget. Is sums all pushed values.
Attributes
Value
@return [#+]
Public Class Methods
Source
# File lib/ttfunk/sum.rb, line 12 def initialize(init_value = 0) super() @value = init_value end
@param init_value [#+] initial value
Calls superclass method
Public Instance Methods
Source
# File lib/ttfunk/sum.rb, line 21 def <<(operand) @value += coerce(operand) end
Push a value. It will be added to the current value.
@param operand [any] @return [void]
Source
# File lib/ttfunk/sum.rb, line 29 def value_or(_default) # value should always be non-nil value end
Get the stored value or default.
@param _default [any] Unused. Here for API compatibility. @return [any]