Sha256: 05a13aa53699e8964f1c574cabd4c4829ced9624f3f3213a1962354e82df2e3b

Contents?: true

Size: 601 Bytes

Versions: 2

Compression:

Stored size: 601 Bytes

Contents

# encoding: utf-8

module ROM
  class Mapper
    class Loader

      # Loader class which doesn't call initialize
      #
      # @private
      class Allocator < self

        # @api private
        def call(tuple)
          allocate { |attribute, object|
            object.instance_variable_set(
              "@#{attribute.name}", tuple[attribute.name]
            )
          }
        end

        private

        # @api private
        def allocate(&block)
          header.each_with_object(model.allocate, &block)
        end

      end # Allocator

    end # Loader
  end # Mapper
end # ROM

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rom-mapper-0.1.1 lib/rom/mapper/loader/allocator.rb
rom-mapper-0.1.0 lib/rom/mapper/loader/allocator.rb