Class: Moon::Response::JSON::Collection
- Inherits:
-
Moon::Response::JSON
- Object
- Base
- Moon::Response::JSON
- Moon::Response::JSON::Collection
- Defined in:
- lib/moon/response/json/collection.rb
Overview
Moon::Response::JSON::Collection provides a response that contains one single collection.
Instance Attribute Summary
Attributes inherited from Moon::Response::JSON
Instance Method Summary collapse
-
#initialize(collection, formatters) ⇒ Collection
constructor
A new instance of Collection.
Methods inherited from Moon::Response::JSON
Methods inherited from Base
Constructor Details
#initialize(collection, formatters) ⇒ Collection
Returns a new instance of Collection.
5 6 7 8 9 10 |
# File 'lib/moon/response/json/collection.rb', line 5 def initialize(collection, formatters) @collection = collection.map do |object| Moon::Formatter.hash_for formatters, object end super 200, @collection end |