Class: Nws::Api::Alerts::AlertSet
- Inherits:
-
Object
- Object
- Nws::Api::Alerts::AlertSet
- Includes:
- Enumerable
- Defined in:
- lib/nws/api/alerts/alert_set.rb
Instance Attribute Summary collapse
-
#alerts ⇒ Object
readonly
Returns the value of attribute alerts.
Instance Method Summary collapse
- #<<(alert) ⇒ Object
- #[](idx) ⇒ Object
- #each(&block) ⇒ Object
- #expected ⇒ Object
- #first ⇒ Object
- #future ⇒ Object
- #immediate ⇒ Object
-
#initialize(alerts = nil) ⇒ AlertSet
constructor
A new instance of AlertSet.
- #last ⇒ Object
- #likely ⇒ Object
- #minor ⇒ Object
- #moderate ⇒ Object
- #observed ⇒ Object
- #past ⇒ Object
- #possible ⇒ Object
- #severe ⇒ Object
- #unknown_certainty ⇒ Object
- #unknown_severity ⇒ Object
- #unknown_urgency ⇒ Object
- #with_geometry ⇒ Object
- #without_geometry ⇒ Object
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
#alerts ⇒ Object (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 |
#expected ⇒ Object
63 64 65 |
# File 'lib/nws/api/alerts/alert_set.rb', line 63 def expected urgency_filter_for('Expected') end |
#first ⇒ Object
31 32 33 |
# File 'lib/nws/api/alerts/alert_set.rb', line 31 def first alerts.first end |
#future ⇒ Object
67 68 69 |
# File 'lib/nws/api/alerts/alert_set.rb', line 67 def future urgency_filter_for('Future') end |
#immediate ⇒ Object
59 60 61 |
# File 'lib/nws/api/alerts/alert_set.rb', line 59 def immediate urgency_filter_for('Immediate') end |
#last ⇒ Object
35 36 37 |
# File 'lib/nws/api/alerts/alert_set.rb', line 35 def last alerts.last end |
#likely ⇒ Object
83 84 85 |
# File 'lib/nws/api/alerts/alert_set.rb', line 83 def likely certainty_filter_for('Likely') end |
#minor ⇒ Object
43 44 45 |
# File 'lib/nws/api/alerts/alert_set.rb', line 43 def minor severity_filter_for('Minor') end |
#moderate ⇒ Object
47 48 49 |
# File 'lib/nws/api/alerts/alert_set.rb', line 47 def moderate severity_filter_for('Moderate') end |
#observed ⇒ Object
75 76 77 |
# File 'lib/nws/api/alerts/alert_set.rb', line 75 def observed certainty_filter_for('Observed') end |
#past ⇒ Object
55 56 57 |
# File 'lib/nws/api/alerts/alert_set.rb', line 55 def past urgency_filter_for('Past') end |
#possible ⇒ Object
79 80 81 |
# File 'lib/nws/api/alerts/alert_set.rb', line 79 def possible certainty_filter_for('Possible') end |
#severe ⇒ Object
39 40 41 |
# File 'lib/nws/api/alerts/alert_set.rb', line 39 def severe severity_filter_for('Severe') end |
#unknown_certainty ⇒ Object
87 88 89 |
# File 'lib/nws/api/alerts/alert_set.rb', line 87 def unknown_certainty certainty_filter_for('Unknown') end |
#unknown_severity ⇒ Object
51 52 53 |
# File 'lib/nws/api/alerts/alert_set.rb', line 51 def unknown_severity severity_filter_for('Unknown') end |
#unknown_urgency ⇒ Object
71 72 73 |
# File 'lib/nws/api/alerts/alert_set.rb', line 71 def unknown_urgency urgency_filter_for('Unknown') end |
#with_geometry ⇒ Object
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_geometry ⇒ Object
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 |