Class: GenesisRuby::Utils::Money::Base::Strategy
- Inherits:
-
Object
- Object
- GenesisRuby::Utils::Money::Base::Strategy
- Defined in:
- lib/genesis_ruby/utils/money/base/strategy.rb
Overview
Base Conversion Strategy class
Direct Known Subclasses
Conversions::AmountToExponent, Conversions::ExponentToAmount
Instance Attribute Summary collapse
-
#amount ⇒ Object
Returns the value of attribute amount.
-
#currency ⇒ Object
Returns the value of attribute currency.
-
#currency_exponent ⇒ Object
Returns the value of attribute currency_exponent.
Instance Method Summary collapse
-
#convert ⇒ Object
Convert Strategy method.
-
#initialize(amount, currency, currency_exponent) ⇒ Strategy
constructor
Class constructor.
Constructor Details
#initialize(amount, currency, currency_exponent) ⇒ Strategy
Class constructor
16 17 18 19 20 |
# File 'lib/genesis_ruby/utils/money/base/strategy.rb', line 16 def initialize(amount, currency, currency_exponent) @amount = parse_amount(amount) @currency = currency @currency_exponent = currency_exponent end |
Instance Attribute Details
#amount ⇒ Object
Returns the value of attribute amount.
13 14 15 |
# File 'lib/genesis_ruby/utils/money/base/strategy.rb', line 13 def amount @amount end |
#currency ⇒ Object
Returns the value of attribute currency.
13 14 15 |
# File 'lib/genesis_ruby/utils/money/base/strategy.rb', line 13 def currency @currency end |
#currency_exponent ⇒ Object
Returns the value of attribute currency_exponent.
13 14 15 |
# File 'lib/genesis_ruby/utils/money/base/strategy.rb', line 13 def currency_exponent @currency_exponent end |
Instance Method Details
#convert ⇒ Object
Convert Strategy method
23 24 25 |
# File 'lib/genesis_ruby/utils/money/base/strategy.rb', line 23 def convert raise NotImplementedError end |