Sha256: d24ac7c50c4dbdcdfe56fbdb28f3ac4f44d3d929a019d36044d70dd5485bce95

Contents?: true

Size: 524 Bytes

Versions: 2

Compression:

Stored size: 524 Bytes

Contents

module Representable
  module Object
    class Binding < Representable::Binding
      def self.build_for(definition, *args)  # TODO: remove default arg.
        return Collection.new(definition, *args)  if definition.array?
        new(definition, *args)
      end

      def read(hash)
        hash.send(as) # :getter? no, that's for parsing!
      end

      def deserialize_method
        :from_object
      end

      class Collection < self
        include Representable::Binding::Collection
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
representable-2.1.5 lib/representable/object/binding.rb
representable-2.1.4 lib/representable/object/binding.rb