Sha256: b6f0992fbbb3c3bf9403fe6277471f6c830177d8720aa8617a7160f3e11ccbc8

Contents?: true

Size: 613 Bytes

Versions: 1

Compression:

Stored size: 613 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)
        fragment = hash.send(as) # :getter? no, that's for parsing!

        return FragmentNotFound if fragment.nil? and typed?
        fragment
      end

      def deserialize_method
        :from_object
      end

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
representable-2.1.6 lib/representable/object/binding.rb