class PagerDuty::Alert

Attributes

type[RW]
user[RW]

Public Class Methods

new(time, type, user) click to toggle source
Calls superclass method Report::Item::new
# File lib/pagerduty_tools/pagerduty.rb, line 181
def initialize(time, type, user)
  # This charming little chunk works around an apparent bug in Chronic:
  # if the parsed month is the same as the current month, :context =>
  # :past will fail to set the month correctly.  (Looks like
  # 'if @now.month > target_month' on line 28 of
  # chronic-0.3.0/lib/chronic/repeaters/repeater_month_name.rb
  # should be 'if @now.month >= target_month'.) Anyway, there, I
  # fixed it.
  if time.start_with?(Time.now.strftime("%b"))
    super(Chronic.parse(time))
  else
    super(Chronic.parse(time, :context => :past))
  end
  @type = type
  @user = user
end

Public Instance Methods

email?() click to toggle source
# File lib/pagerduty_tools/pagerduty.rb, line 202
def email?
  type == "Email"
end
phone_or_sms?() click to toggle source
# File lib/pagerduty_tools/pagerduty.rb, line 198
def phone_or_sms?
  type == "Phone" or type == "SMS"
end