Class: CommerceUnits::TermsReducer
- Inherits:
-
Object
- Object
- CommerceUnits::TermsReducer
- Defined in:
- lib/commerce_units/terms_reducer.rb
Instance Attribute Summary collapse
-
#value ⇒ Object
Returns the value of attribute value.
Instance Method Summary collapse
-
#initialize(value) ⇒ TermsReducer
constructor
A new instance of TermsReducer.
- #reduce_to_simplest_terms ⇒ Object
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
#value ⇒ Object
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_terms ⇒ Object
8 9 10 |
# File 'lib/commerce_units/terms_reducer.rb', line 8 def reduce_to_simplest_terms _reducing_terms.reduce(value, &:*) end |