Class: EnergyTime

Inherits:
Time
  • Object
show all
Defined in:
lib/aeeg_time/energy_time.rb

Direct Known Subclasses

AeegTime

Instance Method Summary collapse

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

Returns:

  • (Boolean)


6
7
8
# File 'lib/aeeg_time/energy_time.rb', line 6

def holiday?
  sunday? || national_holiday?
end

#hour_countObject



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

Returns:

  • (Boolean)


15
16
17
# File 'lib/aeeg_time/energy_time.rb', line 15

def hour_in?(collection)
  collection.include?(self.hour)
end

#intervalObject



19
20
21
# File 'lib/aeeg_time/energy_time.rb', line 19

def interval
  "#{strftime('%H:00')} -> #{(self+3600).strftime('%H:00')}"
end