Class: Report::Item

Inherits:
Object
  • Object
show all
Defined in:
lib/pagerduty_tools/report.rb

Direct Known Subclasses

PagerDuty::Alert, PagerDuty::Incident

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(time) ⇒ Item

Returns a new instance of Item.



23
24
25
# File 'lib/pagerduty_tools/report.rb', line 23

def initialize(time)
  @time = time
end

Instance Attribute Details

#timeObject

Returns the value of attribute time.



21
22
23
# File 'lib/pagerduty_tools/report.rb', line 21

def time
  @time
end

Instance Method Details

#between?(start_time, end_time) ⇒ Boolean

Returns:

  • (Boolean)


27
28
29
# File 'lib/pagerduty_tools/report.rb', line 27

def between?(start_time, end_time)
  time >= start_time and time < end_time
end

#graveyard?Boolean

Returns:

  • (Boolean)


36
37
38
39
# File 'lib/pagerduty_tools/report.rb', line 36

def graveyard?
  # Worst of the worst - midnight to 8am (localtime)
  time.hour < 8
end

#off_hours?Boolean

Returns:

  • (Boolean)


31
32
33
34
# File 'lib/pagerduty_tools/report.rb', line 31

def off_hours?
  # Outside normal work hours - 6p to 8a (localtime)
  time.hour >= 18 or graveyard?
end