Module: Core::Io::Collection
- Included in:
- Io::ActiveRecord::Relation, Io::Array
- Defined in:
- app/api/core/io/collection.rb
Instance Method Summary collapse
Instance Method Details
#as_json(options = {}) ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 |
# File 'app/api/core/io/collection.rb', line 3 def as_json( = {}) results, base_stream = [:object], [:stream] base_stream.attribute(:size, size_for(results)) base_stream.array([:response].io.json_root.to_s.pluralize, results) do |stream, object| stream.open do ::Core::Io::Registry .instance .lookup_for_object(object) .object_json(object, .merge(stream: stream, target: object, nested: true)) end end end |