Class: GCM::ResponseCollection
- Inherits:
-
Object
- Object
- GCM::ResponseCollection
- Includes:
- Enumerable
- Defined in:
- lib/mercurius/gcm/response_collection.rb
Instance Attribute Summary collapse
-
#recommendations ⇒ Object
readonly
Returns the value of attribute recommendations.
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.
7 8 9 10 |
# File 'lib/mercurius/gcm/response_collection.rb', line 7 def initialize(notification, responses = []) @responses = responses @notification = notification end |
Instance Attribute Details
#recommendations ⇒ Object (readonly)
Returns the value of attribute recommendations.
5 6 7 |
# File 'lib/mercurius/gcm/response_collection.rb', line 5 def recommendations @recommendations end |
Instance Method Details
#<<(response) ⇒ Object
26 27 28 |
# File 'lib/mercurius/gcm/response_collection.rb', line 26 def <<(response) @responses.concat Array(response).flatten end |
#[](index) ⇒ Object
22 23 24 |
# File 'lib/mercurius/gcm/response_collection.rb', line 22 def [](index) @responses[index] end |
#each(&block) ⇒ Object
30 31 32 |
# File 'lib/mercurius/gcm/response_collection.rb', line 30 def each(&block) @responses.each &block end |
#results ⇒ Object
12 13 14 15 16 17 18 19 20 |
# File 'lib/mercurius/gcm/response_collection.rb', line 12 def results out = GCM::ResultCollection.new @responses.map do |response| response.results.each do |result| out << result end end out end |