Sha256: d104de3cb97413ed586c22c43b16e0122ecc233e9b5762a0fb2fcb4a27cc4ff7
Contents?: true
Size: 752 Bytes
Versions: 1
Compression:
Stored size: 752 Bytes
Contents
module ActiveModel class Serializer class ArraySerializer include Enumerable delegate :each, to: :@objects attr_reader :meta, :meta_key def initialize(objects, options = {}) options.merge!(root: nil) @objects = objects.map do |object| serializer_class = options.fetch( :serializer, ActiveModel::Serializer.serializer_for(object) ) serializer_class.new(object, options) end @meta = options[:meta] @meta_key = options[:meta_key] end def json_key @objects.first.json_key if @objects.first end def root=(root) @objects.first.root = root if @objects.first end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
active_model_serializers-0.10.0.rc1 | lib/active_model/serializer/array_serializer.rb |