Sha256: cccf1de427b9759ab3dc50144a39d43b7c9d0180afcbae075052a71f223b3790
Contents?: true
Size: 1.14 KB
Versions: 11
Compression:
Stored size: 1.14 KB
Contents
require 'genesis_ruby/api/constants/currencies/iso4217' require 'genesis_ruby/utils/money/conversions/amount_to_exponent' require 'genesis_ruby/utils/money/conversions/exponent_to_amount' require 'genesis_ruby/utils/money/format' module GenesisRuby module Utils # Money Helper class MoneyFormat class << self # Convert major to minor currency format units def amount_to_exponent(amount, currency) strategy = GenesisRuby::Utils::Money::Conversions::AmountToExponent.new( amount, currency, GenesisRuby::Api::Constants::Currencies::Iso4217.fetch_exponent(currency) ) GenesisRuby::Utils::Money::Format.new(strategy).convert end # Convert minor to major currency format units def exponent_to_amount(amount, currency) strategy = GenesisRuby::Utils::Money::Conversions::ExponentToAmount.new( amount, currency, GenesisRuby::Api::Constants::Currencies::Iso4217.fetch_exponent(currency) ) GenesisRuby::Utils::Money::Format.new(strategy).convert end end end end end
Version data entries
11 entries across 11 versions & 1 rubygems