Class: CommerceUnits::TermsReducer

Inherits:
Object
  • Object
show all
Defined in:
lib/commerce_units/terms_reducer.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(value) ⇒ TermsReducer

Returns a new instance of TermsReducer.



4
5
6
# File 'lib/commerce_units/terms_reducer.rb', line 4

def initialize(value)
  @value = value
end

Instance Attribute Details

#valueObject

Returns the value of attribute value.



2
3
4
# File 'lib/commerce_units/terms_reducer.rb', line 2

def value
  @value
end

Instance Method Details

#reduce_to_simplest_termsObject



8
9
10
# File 'lib/commerce_units/terms_reducer.rb', line 8

def reduce_to_simplest_terms
  _reducing_terms.reduce(value, &:*)
end