class EME::Billing::CurrencyCollection
Attributes
currencies[RW]
payment_types[RW]
Public Class Methods
new(data_array, allowed_types = [])
click to toggle source
- {“SORTNO”=>1, “VIRTUALNAME”=>“1100 EMP”, “PGCODE”=>“PAYPAL”, “CURRENCY”=>“USD”, “PAYAMT”=>10, “CASHAMT”=>1100, “CASHIDENTIFIER”=>“EMP”, “REALCASHAMT”=>1100, “BONUSCASHAMT”=>0}
# File lib/eme/billing.rb, line 338 def initialize(data_array, allowed_types = []) @payment_types = [] @currencies = [] data_array.each do |cur| currency = Currency.new(cur) if allowed_types.empty? || allowed_types.include?(currency.payment_type) @currencies << currency @payment_types << currency.payment_type end end @payment_types.uniq! @currencies.sort!{|a,b| a.position <=> b.position } end
Public Instance Methods
currencies_by_payment_type(type)
click to toggle source
# File lib/eme/billing.rb, line 352 def currencies_by_payment_type(type) @currencies.select{|c| c.payment_type == type} end
to_s()
click to toggle source
# File lib/eme/billing.rb, line 356 def to_s <<-CURR CurrencyCollection #{self.object_id} payment_types: #{@payment_types.inspect} currencies (@currencies.length): #{@currencies.collect{|x| x.to_s}.inspect} CURR end