Class: Shale::Mapping::Group::DictGrouping Private

Inherits:
Object
  • Object
show all
Defined in:
lib/shale/mapping/group/dict_grouping.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.

Class representing mapping group for JSON/YAML/TOML

Direct Known Subclasses

XmlGrouping

Instance Method Summary collapse

Constructor Details

#initializeDictGrouping

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



15
16
17
# File 'lib/shale/mapping/group/dict_grouping.rb', line 15

def initialize
  @groups = {}
end

Instance Method Details

#add(mapping, value) ⇒ 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.

Add a value to a group

Parameters:



25
26
27
28
# File 'lib/shale/mapping/group/dict_grouping.rb', line 25

def add(mapping, value)
  group = @groups[mapping.group] ||= Dict.new(mapping.method_from, mapping.method_to)
  group.add(mapping.name, value)
end

#each(&block) ⇒ 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.

Iterate over groups

Parameters:

  • block (Proc)


35
36
37
# File 'lib/shale/mapping/group/dict_grouping.rb', line 35

def each(&block)
  @groups.values.each(&block)
end