Module: Paypal::Util
- Included in:
- Base
- Defined in:
- lib/paypal/util.rb
Class Method Summary (collapse)
Instance Method Summary (collapse)
Class Method Details
+ (Object) formatted_amount(x)
4 5 6 7 |
# File 'lib/paypal/util.rb', line 4 def self.formatted_amount(x) # Thanks @nahi ;) sprintf "%0.2f", BigDecimal.new(x.to_s).truncate(2) end |
+ (Object) to_numeric(x)
9 10 11 12 13 14 15 |
# File 'lib/paypal/util.rb', line 9 def self.to_numeric(x) if x.to_f == x.to_i x.to_i else x.to_f end end |
Instance Method Details
- (Object) ==(other)
21 22 23 24 25 |
# File 'lib/paypal/util.rb', line 21 def ==(other) instance_variables.all? do |key| instance_variable_get(key) == other.instance_variable_get(key) end end |
- (Boolean) numeric_attribute?(key)
17 18 19 |
# File 'lib/paypal/util.rb', line 17 def numeric_attribute?(key) !!(key.to_s =~ /(amount|frequency|cycles|paid)/) end |