Class: Nws::Api::Alerts::AlertSet

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/nws/api/alerts/alert_set.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(alerts = nil) ⇒ AlertSet

Returns a new instance of AlertSet.



11
12
13
# File 'lib/nws/api/alerts/alert_set.rb', line 11

def initialize(alerts = nil)
  @alerts = alerts.is_a?(Array) ? alerts : []
end

Instance Attribute Details

#alertsObject (readonly)

Returns the value of attribute alerts.



9
10
11
# File 'lib/nws/api/alerts/alert_set.rb', line 9

def alerts
  @alerts
end

Instance Method Details

#<<(alert) ⇒ Object



15
16
17
# File 'lib/nws/api/alerts/alert_set.rb', line 15

def <<(alert)
  @alerts << alert
end

#[](idx) ⇒ Object



27
28
29
# File 'lib/nws/api/alerts/alert_set.rb', line 27

def [](idx)
  alerts[idx]
end

#each(&block) ⇒ Object



19
20
21
22
# File 'lib/nws/api/alerts/alert_set.rb', line 19

def each(&block)
  alerts.each(&block)
  self
end

#expectedObject



63
64
65
# File 'lib/nws/api/alerts/alert_set.rb', line 63

def expected
  urgency_filter_for('Expected')
end

#firstObject



31
32
33
# File 'lib/nws/api/alerts/alert_set.rb', line 31

def first
  alerts.first
end

#futureObject



67
68
69
# File 'lib/nws/api/alerts/alert_set.rb', line 67

def future
  urgency_filter_for('Future')
end

#immediateObject



59
60
61
# File 'lib/nws/api/alerts/alert_set.rb', line 59

def immediate
  urgency_filter_for('Immediate')
end

#lastObject



35
36
37
# File 'lib/nws/api/alerts/alert_set.rb', line 35

def last
  alerts.last
end

#likelyObject



83
84
85
# File 'lib/nws/api/alerts/alert_set.rb', line 83

def likely
  certainty_filter_for('Likely')
end

#minorObject



43
44
45
# File 'lib/nws/api/alerts/alert_set.rb', line 43

def minor
  severity_filter_for('Minor')
end

#moderateObject



47
48
49
# File 'lib/nws/api/alerts/alert_set.rb', line 47

def moderate
  severity_filter_for('Moderate')
end

#observedObject



75
76
77
# File 'lib/nws/api/alerts/alert_set.rb', line 75

def observed
  certainty_filter_for('Observed')
end

#pastObject



55
56
57
# File 'lib/nws/api/alerts/alert_set.rb', line 55

def past
  urgency_filter_for('Past')
end

#possibleObject



79
80
81
# File 'lib/nws/api/alerts/alert_set.rb', line 79

def possible
  certainty_filter_for('Possible')
end

#severeObject



39
40
41
# File 'lib/nws/api/alerts/alert_set.rb', line 39

def severe
  severity_filter_for('Severe')
end

#unknown_certaintyObject



87
88
89
# File 'lib/nws/api/alerts/alert_set.rb', line 87

def unknown_certainty
  certainty_filter_for('Unknown')
end

#unknown_severityObject



51
52
53
# File 'lib/nws/api/alerts/alert_set.rb', line 51

def unknown_severity
 severity_filter_for('Unknown')
end

#unknown_urgencyObject



71
72
73
# File 'lib/nws/api/alerts/alert_set.rb', line 71

def unknown_urgency
  urgency_filter_for('Unknown')
end

#with_geometryObject



91
92
93
# File 'lib/nws/api/alerts/alert_set.rb', line 91

def with_geometry
  return self.class.new(self.select{|alert| alert.geometry })
end

#without_geometryObject



95
96
97
# File 'lib/nws/api/alerts/alert_set.rb', line 95

def without_geometry
  return self.class.new(self.reject{|alert| alert.geometry })
end