Module: Qtpay::Utils
- Defined in:
- lib/qtpay/utils.rb
Class Method Summary collapse
Class Method Details
.stringify_keys(hash) ⇒ Object
3 4 5 6 7 8 9 |
# File 'lib/qtpay/utils.rb', line 3 def self.stringify_keys(hash) new_hash = {} hash.each do |key, value| new_hash[(key.to_s rescue key) || key] = value end new_hash end |
.to_cents(dollars) ⇒ Object
11 12 13 14 |
# File 'lib/qtpay/utils.rb', line 11 def self.to_cents(dollars) (dollars.to_d * 100).ceil end |
.to_dollars(cents) ⇒ Object
16 17 18 |
# File 'lib/qtpay/utils.rb', line 16 def self.to_dollars(cents) cents.to_d / 100.0 end |