Class: EnergyTime
- Inherits:
-
Time
- Object
- Time
- EnergyTime
- Defined in:
- lib/aeeg_time/energy_time.rb
Direct Known Subclasses
Instance Method Summary collapse
- #+(seconds) ⇒ Object
- #holiday? ⇒ Boolean
- #hour_count ⇒ Object
-
#hour_in?(collection) ⇒ Boolean
collection must be a Range or an Array.
- #interval ⇒ Object
Instance Method Details
#+(seconds) ⇒ Object
10 11 12 |
# File 'lib/aeeg_time/energy_time.rb', line 10 def +(seconds) self.class.at(super(seconds)) end |
#holiday? ⇒ Boolean
6 7 8 |
# File 'lib/aeeg_time/energy_time.rb', line 6 def holiday? sunday? || national_holiday? end |
#hour_count ⇒ Object
24 25 26 |
# File 'lib/aeeg_time/energy_time.rb', line 24 def hour_count hour+1 end |
#hour_in?(collection) ⇒ Boolean
collection must be a Range or an Array
15 16 17 |
# File 'lib/aeeg_time/energy_time.rb', line 15 def hour_in?(collection) collection.include?(self.hour) end |
#interval ⇒ Object
19 20 21 |
# File 'lib/aeeg_time/energy_time.rb', line 19 def interval "#{strftime('%H:00')} -> #{(self+3600).strftime('%H:00')}" end |