Sha256: 1f9d57923392008dceb5bc1ac1f2bb6ba399ebb74b25bc9f844603c7d14b0c86
Contents?: true
Size: 683 Bytes
Versions: 1
Compression:
Stored size: 683 Bytes
Contents
# frozen_string_literal: true module AdequateSerialization class Serializer class << self def attributes @attributes ||= [] end def attribute(*names, &block) options = if names.last.is_a?(Hash) names.pop else {} end additions = names.map! { |name| Attribute.from(name, options.dup, &block) } @attributes = attributes + additions end end def serialize(model, opts = Options.null) self.class.attributes.each_with_object({}) do |attribute, response| attribute.serialize_to(response, model, opts.includes) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
adequate_serialization-0.0.1 | lib/adequate_serialization/serializer.rb |