Class: ActiveMerchant::Billing::CreditCard::ExpiryYear

Inherits:
Fixnum
  • Object
show all
Defined in:
lib/active_merchant/billing/credit_card.rb

Overview

:nodoc:

Instance Method Summary collapse

Instance Method Details

#to_s(format = :default) ⇒ Object

:nodoc:



38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/active_merchant/billing/credit_card.rb', line 38

def to_s(format = :default) #:nodoc:
  case format
  when :default
    __getobj__.to_s
  when :two_digit
    sprintf("%.2i", self)[-2..-1]
  when :four_digit
    sprintf("%.4i", self)
  else
    super
  end  
end

#valid?Boolean

:nodoc:

Returns:

  • (Boolean)


51
52
53
# File 'lib/active_merchant/billing/credit_card.rb', line 51

def valid? #:nodoc:
  (Time.now.year..Time.now.year + 20).include?(self)
end