Sha256: 1ba41727e1367030d02e0d99173fc0fea27a6d13721a20b9eb2501d07db9591d

Contents?: true

Size: 351 Bytes

Versions: 4

Compression:

Stored size: 351 Bytes

Contents

module Qtpay
  module Utils
    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

    def self.to_cents(dollars)
      (dollars.to_d * 100).ceil

    end

    def self.to_dollars(cents)
      cents.to_d / 100.0
    end

  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
qtpay-0.0.4 lib/qtpay/utils.rb
qtpay-0.0.3 lib/qtpay/utils.rb
qtpay-0.0.2 lib/qtpay/utils.rb
qtpay-0.0.1 lib/qtpay/utils.rb