Class: CommerceUnits::Simplifier
- Inherits:
-
Object
- Object
- CommerceUnits::Simplifier
- Defined in:
- lib/commerce_units/simplifier.rb
Defined Under Namespace
Classes: NotComparable
Instance Method Summary collapse
- #denominator ⇒ Object
-
#initialize(numerator: [], denominator: []) ⇒ Simplifier
constructor
A new instance of Simplifier.
- #numerator ⇒ Object
Constructor Details
#initialize(numerator: [], denominator: []) ⇒ Simplifier
Returns a new instance of Simplifier.
3 4 5 6 |
# File 'lib/commerce_units/simplifier.rb', line 3 def initialize(numerator: [], denominator: []) @original_top = numerator.sort @original_bot = denominator.sort end |
Instance Method Details
#denominator ⇒ Object
12 13 14 |
# File 'lib/commerce_units/simplifier.rb', line 12 def denominator @denominator ||= _reduced_denominator_from top: @original_top, bot: @original_bot end |
#numerator ⇒ Object
8 9 10 |
# File 'lib/commerce_units/simplifier.rb', line 8 def numerator @numerator ||= _reduced_numerator_from top: @original_top, bot: @original_bot end |