| Module | ActiveMerchant::Billing::CreditCardFormatting |
| In: |
lib/active_merchant/billing/credit_card_formatting.rb
|
This method is used to format numerical information pertaining to credit cards.
format(2005, :two_digits) # => "05" format(05, :four_digits) # => "0005"
# File lib/active_merchant/billing/credit_card_formatting.rb, line 9
9: def format(number, option)
10: return '' if number.blank?
11:
12: case option
13: when :two_digits ; sprintf("%.2i", number)[-2..-1]
14: when :four_digits ; sprintf("%.4i", number)[-4..-1]
15: else number
16: end
17: end