class AMA::Entity::Mapper::Type::BuiltIn::HashTupleType

Pair class definition

Constants

INSTANCE

Public Class Methods

new() click to toggle source
Calls superclass method AMA::Entity::Mapper::Type::new
# File lib/ama-entity-mapper/type/builtin/hash_tuple_type.rb, line 13
def initialize
  super(Aux::HashTuple, virtual: true)

  attribute!(:key, parameter!(:K))
  attribute!(:value, parameter!(:V))

  enumerator_block do |entity, type, *|
    ::Enumerator.new do |yielder|
      yielder << [type.attributes[:key], entity.key, nil]
      yielder << [type.attributes[:value], entity.value, nil]
    end
  end
end