Sha256: c097d60ee85cbe917d6141f48a8dd0a33e79f331f5093aa0803ad88427b71197
Contents?: true
Size: 579 Bytes
Versions: 138
Compression:
Stored size: 579 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)[-2..-1] when :four_digits ; sprintf("%.4i", number)[-4..-1] else number end end end end end
Version data entries
138 entries across 138 versions & 34 rubygems