class AMA::Entity::Mapper::Type::Parameter

This class represents parameter type - an unknown-until-runtime type that belongs to particular other type. For example, Hash<Symbol, Integer> may be described as Type(Hash) with parameters _key: Symbol and _value: Integer

Attributes

id[R]

@!attribute id

@return [Symbol]
owner[R]

@!attribute type

@return [AMA::Entity::Mapper::Type]

Public Class Methods

new(owner, id) click to toggle source

@param [AMA::Entity::Mapper::Type] owner @param [Symbol] id

# File lib/ama-entity-mapper/type/parameter.rb, line 25
def initialize(owner, id)
  @owner = owner
  @id = id
end

Public Instance Methods

==(other) click to toggle source
# File lib/ama-entity-mapper/type/parameter.rb, line 63
def ==(other)
  eql?(other)
end
eql?(other) click to toggle source
# File lib/ama-entity-mapper/type/parameter.rb, line 58
def eql?(other)
  return false unless other.is_a?(self.class)
  @id == other.id && @owner == other.owner
end
hash() click to toggle source
# File lib/ama-entity-mapper/type/parameter.rb, line 54
def hash
  @owner.hash ^ @id.hash
end
instance?(_) click to toggle source
# File lib/ama-entity-mapper/type/parameter.rb, line 30
def instance?(_)
  false
end
resolve_parameter(*) click to toggle source
# File lib/ama-entity-mapper/type/parameter.rb, line 34
def resolve_parameter(*)
  self
end
resolved!(context = nil) click to toggle source
# File lib/ama-entity-mapper/type/parameter.rb, line 42
def resolved!(context = nil)
  compliance_error("Type #{self} is not resolved", context: context)
end
resolved?() click to toggle source
# File lib/ama-entity-mapper/type/parameter.rb, line 38
def resolved?
  false
end
to_def() click to toggle source
# File lib/ama-entity-mapper/type/parameter.rb, line 50
def to_def
  "#{owner.type}.#{id}"
end
to_s() click to toggle source
# File lib/ama-entity-mapper/type/parameter.rb, line 46
def to_s
  "Parameter #{owner.type}.#{id}"
end