Sha256: 3d01b39597bc82224e87ddc51d17119ba379efbe01d723ce9df2fd816c2c2a0f
Contents?: true
Size: 524 Bytes
Versions: 3
Compression:
Stored size: 524 Bytes
Contents
module Paypal module Util def self.formatted_amount(x) # Thanks @nahi ;) sprintf "%0.2f", BigDecimal.new(x.to_f.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
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
creative-paypal-express-1.4.1 | lib/paypal/util.rb |
creative-paypal-express-1.4.0 | lib/paypal/util.rb |
creative-paypal-express-1.3.0 | lib/paypal/util.rb |