Class: Shale::Mapping::Dict Private
- Defined in:
- lib/shale/mapping/dict.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.
Mapping for dictionary serialization formats (Hash/JSON/YAML/TOML/CSV)
Direct Known Subclasses
Instance Attribute Summary
Attributes inherited from DictBase
Instance Method Summary collapse
-
#group(from:, to:, &block) ⇒ Object
private
Map group of keys to mapping methods.
-
#map(key, to: nil, receiver: nil, using: nil, render_nil: nil, schema: nil) ⇒ Object
Map key to attribute.
-
#render_nil(val) ⇒ Object
private
Set render_nil default.
Methods inherited from DictBase
#finalize!, #finalized?, #initialize, #initialize_dup, #properties
Constructor Details
This class inherits a constructor from Shale::Mapping::DictBase
Instance Method Details
#group(from:, to:, &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.
Map group of keys to mapping methods
44 45 46 47 48 |
# File 'lib/shale/mapping/dict.rb', line 44 def group(from:, to:, &block) group = DictGroup.new(from, to) group.instance_eval(&block) @keys.merge!(group.keys) end |
#map(key, to: nil, receiver: nil, using: nil, render_nil: nil, schema: nil) ⇒ Object
Map key to attribute
24 25 26 |
# File 'lib/shale/mapping/dict.rb', line 24 def map(key, to: nil, receiver: nil, using: nil, render_nil: nil, schema: nil) super(key, to: to, receiver: receiver, using: using, render_nil: render_nil, schema: schema) end |
#render_nil(val) ⇒ 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.
Set render_nil default
33 34 35 |
# File 'lib/shale/mapping/dict.rb', line 33 def render_nil(val) @render_nil_default = val end |