Class: Creditcard::ExpiryDate
Overview
:nodoc:
Instance Attribute Summary collapse
-
#month ⇒ Object
readonly
Returns the value of attribute month.
-
#year ⇒ Object
readonly
Returns the value of attribute year.
Instance Method Summary collapse
-
#expiration ⇒ Object
:nodoc:.
-
#expired? ⇒ Boolean
:nodoc:.
-
#initialize(month, year) ⇒ ExpiryDate
constructor
A new instance of ExpiryDate.
Constructor Details
#initialize(month, year) ⇒ ExpiryDate
Returns a new instance of ExpiryDate.
14 15 16 17 |
# File 'app/models/creditcard.rb', line 14 def initialize(month, year) @month = month @year = year end |
Instance Attribute Details
#month ⇒ Object (readonly)
Returns the value of attribute month.
13 14 15 |
# File 'app/models/creditcard.rb', line 13 def month @month end |
#year ⇒ Object (readonly)
Returns the value of attribute year.
13 14 15 |
# File 'app/models/creditcard.rb', line 13 def year @year end |
Instance Method Details
#expiration ⇒ Object
:nodoc:
23 24 25 |
# File 'app/models/creditcard.rb', line 23 def expiration #:nodoc: Time.parse("#{month}/#{month_days}/#{year} 23:59:59") rescue Time.at(0) end |
#expired? ⇒ Boolean
:nodoc:
19 20 21 |
# File 'app/models/creditcard.rb', line 19 def expired? #:nodoc: Time.now > expiration rescue true end |