Class: PagerDuty::Alert
- Inherits:
-
Report::Item
- Object
- Report::Item
- PagerDuty::Alert
- Defined in:
- lib/pagerduty_tools/pagerduty.rb
Instance Attribute Summary collapse
-
#type ⇒ Object
Returns the value of attribute type.
-
#user ⇒ Object
Returns the value of attribute user.
Attributes inherited from Report::Item
Instance Method Summary collapse
- #email? ⇒ Boolean
-
#initialize(time, type, user) ⇒ Alert
constructor
A new instance of Alert.
- #phone_or_sms? ⇒ Boolean
Methods inherited from Report::Item
#between?, #graveyard?, #off_hours?
Constructor Details
#initialize(time, type, user) ⇒ Alert
Returns a new instance of Alert.
181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 |
# 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 |
Instance Attribute Details
#type ⇒ Object
Returns the value of attribute type.
179 180 181 |
# File 'lib/pagerduty_tools/pagerduty.rb', line 179 def type @type end |
#user ⇒ Object
Returns the value of attribute user.
179 180 181 |
# File 'lib/pagerduty_tools/pagerduty.rb', line 179 def user @user end |
Instance Method Details
#email? ⇒ Boolean
202 203 204 |
# File 'lib/pagerduty_tools/pagerduty.rb', line 202 def email? type == "Email" end |
#phone_or_sms? ⇒ Boolean
198 199 200 |
# File 'lib/pagerduty_tools/pagerduty.rb', line 198 def phone_or_sms? type == "Phone" or type == "SMS" end |