Class: Shale::Mapping::Group::DictGrouping Private
- Inherits:
-
Object
- Object
- Shale::Mapping::Group::DictGrouping
- 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
Instance Method Summary collapse
-
#add(mapping, value) ⇒ Object
private
Add a value to a group.
-
#each(&block) ⇒ Object
private
Iterate over groups.
-
#initialize ⇒ DictGrouping
constructor
private
Initialize instance.
Constructor Details
#initialize ⇒ DictGrouping
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
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
35 36 37 |
# File 'lib/shale/mapping/group/dict_grouping.rb', line 35 def each(&block) @groups.values.each(&block) end |