Sha256: 9df7bb7e21c5ff3b2789c5f9f1d3e0948d13cec84beb6233a4e2df9f320ffc00
Contents?: true
Size: 568 Bytes
Versions: 39
Compression:
Stored size: 568 Bytes
Contents
module ActiveMerchant #:nodoc: module Billing #:nodoc: module CreditCardFormatting # This method is used to format numerical information pertaining to credit cards. # # format(2005, :two_digits) # => "05" # format(05, :four_digits) # => "0005" def format(number, option) return '' if number.blank? case option when :two_digits ; sprintf("%.2i", number.to_i)[-2..-1] when :four_digits ; sprintf("%.4i", number.to_i)[-4..-1] else number end end end end end
Version data entries
39 entries across 39 versions & 2 rubygems