Class: Shale::Mapping::DictGroup Private

Inherits:
DictBase
  • Object
show all
Defined in:
lib/shale/mapping/dict_group.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Group for dictionary serialization formats (Hash/JSON/YAML/TOML/CSV)

Instance Attribute Summary collapse

Attributes inherited from DictBase

#keys, #root

Instance Method Summary collapse

Methods inherited from DictBase

#finalize!, #finalized?, #initialize_dup, #properties

Constructor Details

#initialize(from, to) ⇒ DictGroup

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Initialize instance

Parameters:

  • from (Symbol)
  • to (Symbol)


24
25
26
27
28
29
# File 'lib/shale/mapping/dict_group.rb', line 24

def initialize(from, to)
  super()
  @from = from
  @to = to
  @name = "group_#{hash}"
end

Instance Attribute Details

#nameString (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Return name of the group

Returns:

  • (String)


16
17
18
# File 'lib/shale/mapping/dict_group.rb', line 16

def name
  @name
end

Instance Method Details

#map(key) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Map key to attribute

Parameters:

  • key (String)


36
37
38
# File 'lib/shale/mapping/dict_group.rb', line 36

def map(key)
  super(key, using: { from: @from, to: @to }, group: @name)
end