Class: Maia::FCM::ResponseCollection
- Inherits:
-
Object
- Object
- Maia::FCM::ResponseCollection
- Includes:
- Enumerable
- Defined in:
- lib/maia/fcm/response_collection.rb
Instance Method Summary collapse
- #<<(response) ⇒ Object
- #[](index) ⇒ Object
- #each(&block) ⇒ Object
-
#initialize(notification, responses = []) ⇒ ResponseCollection
constructor
A new instance of ResponseCollection.
- #results ⇒ Object
Constructor Details
#initialize(notification, responses = []) ⇒ ResponseCollection
Returns a new instance of ResponseCollection.
6 7 8 9 |
# File 'lib/maia/fcm/response_collection.rb', line 6 def initialize(notification, responses = []) @notification = notification @responses = responses end |
Instance Method Details
#<<(response) ⇒ Object
25 26 27 |
# File 'lib/maia/fcm/response_collection.rb', line 25 def <<(response) @responses.concat Array(response).flatten end |
#[](index) ⇒ Object
21 22 23 |
# File 'lib/maia/fcm/response_collection.rb', line 21 def [](index) @responses[index] end |
#each(&block) ⇒ Object
29 30 31 |
# File 'lib/maia/fcm/response_collection.rb', line 29 def each(&block) @responses.each(&block) end |
#results ⇒ Object
11 12 13 14 15 16 17 18 19 |
# File 'lib/maia/fcm/response_collection.rb', line 11 def results collection = ResultCollection.new @responses.each do |response| response.results.each do |result| collection << result end end collection end |