Class: Dialekt::Model::MapProperty::Entry

Inherits:
Object
  • Object
show all
Defined in:
lib/dialekt/model/map_property.rb

Overview

Entry configuration

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name:, key_type:, value_type:, key_transformer: nil, value_factory: nil, value_transformer: nil) ⇒ Entry

Returns a new instance of Entry.



14
15
16
17
18
19
20
21
# File 'lib/dialekt/model/map_property.rb', line 14

def initialize(name:, key_type:, value_type:, key_transformer: nil, value_factory: nil, value_transformer: nil)
  @name = name.to_sym
  @key_type = key_type
  @key_transformer = key_transformer&.call_adapter
  @value_type = value_type
  @value_factory = value_factory&.call_adapter
  @value_transformer = value_transformer&.call_adapter
end

Instance Attribute Details

#key_transformerObject (readonly)

Returns the value of attribute key_transformer.



12
13
14
# File 'lib/dialekt/model/map_property.rb', line 12

def key_transformer
  @key_transformer
end

#key_typeObject (readonly)

Returns the value of attribute key_type.



12
13
14
# File 'lib/dialekt/model/map_property.rb', line 12

def key_type
  @key_type
end

#nameObject (readonly)

Returns the value of attribute name.



12
13
14
# File 'lib/dialekt/model/map_property.rb', line 12

def name
  @name
end

#value_factoryObject (readonly)

Returns the value of attribute value_factory.



12
13
14
# File 'lib/dialekt/model/map_property.rb', line 12

def value_factory
  @value_factory
end

#value_transformerObject (readonly)

Returns the value of attribute value_transformer.



12
13
14
# File 'lib/dialekt/model/map_property.rb', line 12

def value_transformer
  @value_transformer
end

#value_typeObject (readonly)

Returns the value of attribute value_type.



12
13
14
# File 'lib/dialekt/model/map_property.rb', line 12

def value_type
  @value_type
end

Instance Method Details

#to_sObject



23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/dialekt/model/map_property.rb', line 23

def to_s
  result = StringIO.new
  result << @name << " (" << self.class.base_name << ") {"
  result << "key_type: " << @key_type.to_s
  result << ", key_transformer: " << @key_transformer.source_info if @key_transformer
  result << ", value_type: " << @value_type.to_s
  result << ", value_factory: " << @value_factory.source_info if @value_factory
  result << ", value_transformer: " << @value_transformer.source_info if @value_transformer
  result << "}"

  result.string
end