Class: GenesisRuby::Utils::Formatters::Response::Formats::Amount
- Defined in:
- lib/genesis_ruby/utils/formatters/response/formats/amount.rb
Overview
Response Amount Formatter. Converts Minor Currency to Major currency format
Instance Method Summary collapse
-
#format_key(amount, currency) ⇒ Object
Format the given amount response key and its currency to major currency format.
-
#formatting_keys ⇒ Object
The Response keys that the formatter will be applied to.
-
#required_keys ⇒ Object
The keys required for formatting the specific response key.
Methods inherited from Base
Instance Method Details
#format_key(amount, currency) ⇒ Object
Format the given amount response key and its currency to major currency format
25 26 27 28 29 |
# File 'lib/genesis_ruby/utils/formatters/response/formats/amount.rb', line 25 def format_key(amount, currency) GenesisRuby::Utils::MoneyFormat.exponent_to_amount(amount, currency) rescue StandardError amount end |
#formatting_keys ⇒ Object
The Response keys that the formatter will be applied to
15 16 17 |
# File 'lib/genesis_ruby/utils/formatters/response/formats/amount.rb', line 15 def formatting_keys %w(amount leftover_amount) end |
#required_keys ⇒ Object
The keys required for formatting the specific response key
20 21 22 |
# File 'lib/genesis_ruby/utils/formatters/response/formats/amount.rb', line 20 def required_keys %w(currency) end |