Sha256: 04c8174088584199428496290c0eac4115a1093f25f0525b1232b3dee43b1a15

Contents?: true

Size: 570 Bytes

Versions: 1

Compression:

Stored size: 570 Bytes

Contents

# encoding: utf-8

module ROM
  class Mapper

    # Represents a mapping attribute
    #
    # @private
    class Attribute < Struct.new(:name, :field)
      include Adamantium, Equalizer.new(:name, :field)

      # @api private
      def self.coerce(input, mapping = nil)
        field = Axiom::Attribute.coerce(input)
        new(mapping || field.name, field)
      end

      # @api private
      def mapping
        { tuple_key => name }
      end

      # @api private
      def tuple_key
        field.name
      end

    end # Attribute

  end # Mapper
end # ROM

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rom-mapper-0.1.1 lib/rom/mapper/attribute.rb