Sha256: dc2e430fc905f459f96c66fd0aefd41f84b47f3c935638fe7ec917d9c89c4109
Contents?: true
Size: 502 Bytes
Versions: 2
Compression:
Stored size: 502 Bytes
Contents
module Paypal module Util def self.formatted_amount(x) sprintf "%0.2f", BigDecimal.new((x || 0).to_s).truncate(2) end def self.to_numeric(x) if x.to_f == x.to_i x.to_i else x.to_f end end def numeric_attribute?(key) !!(key.to_s =~ /(amount|frequency|cycles|paid)/) end def ==(other) instance_variables.all? do |key| instance_variable_get(key) == other.instance_variable_get(key) end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
ianfleeton-paypal-express-0.8.3 | lib/paypal/util.rb |
ianfleeton-paypal-express-0.8.2 | lib/paypal/util.rb |