Class: ActiveMerchant::Billing::CreditCard::ExpiryYear
- Inherits:
-
Fixnum
- Object
- Fixnum
- ActiveMerchant::Billing::CreditCard::ExpiryYear
- Defined in:
- lib/active_merchant/billing/credit_card.rb
Overview
:nodoc:
Instance Method Summary collapse
-
#to_s(format = :default) ⇒ Object
:nodoc:.
-
#valid? ⇒ Boolean
:nodoc:.
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:
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 |