Class: Cycle
- Inherits:
-
Object
- Object
- Cycle
- Defined in:
- lib/nacofetch/cycle.rb
Instance Attribute Summary collapse
-
#effective ⇒ Object
Returns the value of attribute effective.
-
#ending ⇒ Object
Returns the value of attribute ending.
-
#number ⇒ Object
Returns the value of attribute number.
-
#url ⇒ Object
Returns the value of attribute url.
Instance Method Summary collapse
-
#initialize(url, number, effective, ending) ⇒ Cycle
constructor
A new instance of Cycle.
- #status ⇒ Object
Constructor Details
#initialize(url, number, effective, ending) ⇒ Cycle
Returns a new instance of Cycle.
6 7 8 9 10 11 |
# File 'lib/nacofetch/cycle.rb', line 6 def initialize(url, number, effective, ending) @url = url @number = number @effective = effective @ending = ending end |
Instance Attribute Details
#effective ⇒ Object
Returns the value of attribute effective.
4 5 6 |
# File 'lib/nacofetch/cycle.rb', line 4 def effective @effective end |
#ending ⇒ Object
Returns the value of attribute ending.
4 5 6 |
# File 'lib/nacofetch/cycle.rb', line 4 def ending @ending end |
#number ⇒ Object
Returns the value of attribute number.
4 5 6 |
# File 'lib/nacofetch/cycle.rb', line 4 def number @number end |
#url ⇒ Object
Returns the value of attribute url.
4 5 6 |
# File 'lib/nacofetch/cycle.rb', line 4 def url @url end |
Instance Method Details
#status ⇒ Object
13 14 15 16 17 18 19 |
# File 'lib/nacofetch/cycle.rb', line 13 def status now = Time.new return "PENDING" if now.before?@effective return "CURRENT" if now.before?@ending and now.after?@effective "EXPIRED" if now.after?@ending end |