Class: Depth::ComplexHash
- Inherits:
-
Object
- Object
- Depth::ComplexHash
- Includes:
- Actions, Enumeration::Enumerable
- Defined in:
- lib/depth/complex_hash.rb
Constant Summary collapse
- DEFAULT_KEY_TRANSFORMER =
proc { |obj, key| key }
- DEFAULT_NEXT_PROC =
proc { |obj, key| obj[key] }
- DEFAULT_CREATION_PROC =
proc { |obj, key, val| obj[key] = val }
Instance Attribute Summary collapse
-
#base ⇒ Object
(also: #to_h)
readonly
Returns the value of attribute base.
-
#creation_proc ⇒ Object
readonly
Returns the value of attribute creation_proc.
-
#key_transformer ⇒ Object
readonly
Returns the value of attribute key_transformer.
-
#next_proc ⇒ Object
readonly
Returns the value of attribute next_proc.
Instance Method Summary collapse
-
#initialize(base = {}, key_transformer: DEFAULT_KEY_TRANSFORMER, next_proc: DEFAULT_NEXT_PROC, creation_proc: DEFAULT_CREATION_PROC) ⇒ ComplexHash
constructor
A new instance of ComplexHash.
Methods included from Enumeration::Enumerable
#each, #each_with_object, #map, #map!, #map_keys, #map_keys!, #map_values, #map_values!, #reduce, #reject, #select
Methods included from Actions
Constructor Details
#initialize(base = {}, key_transformer: DEFAULT_KEY_TRANSFORMER, next_proc: DEFAULT_NEXT_PROC, creation_proc: DEFAULT_CREATION_PROC) ⇒ ComplexHash
Returns a new instance of ComplexHash.
10 11 12 13 14 15 16 17 18 |
# File 'lib/depth/complex_hash.rb', line 10 def initialize(base = {}, key_transformer: DEFAULT_KEY_TRANSFORMER, next_proc: DEFAULT_NEXT_PROC, creation_proc: DEFAULT_CREATION_PROC) @base = base @next_proc = next_proc @creation_proc = creation_proc @key_transformer = key_transformer end |
Instance Attribute Details
#base ⇒ Object (readonly) Also known as: to_h
Returns the value of attribute base.
8 9 10 |
# File 'lib/depth/complex_hash.rb', line 8 def base @base end |
#creation_proc ⇒ Object (readonly)
Returns the value of attribute creation_proc.
8 9 10 |
# File 'lib/depth/complex_hash.rb', line 8 def creation_proc @creation_proc end |
#key_transformer ⇒ Object (readonly)
Returns the value of attribute key_transformer.
8 9 10 |
# File 'lib/depth/complex_hash.rb', line 8 def key_transformer @key_transformer end |
#next_proc ⇒ Object (readonly)
Returns the value of attribute next_proc.
8 9 10 |
# File 'lib/depth/complex_hash.rb', line 8 def next_proc @next_proc end |