Class: Hash::DeepHashConstructor
- Inherits:
-
Object
- Object
- Hash::DeepHashConstructor
- Defined in:
- lib/hash/deep_hash_constructor.rb
Instance Attribute Summary collapse
-
#separator ⇒ Object
Returns the value of attribute separator.
Instance Method Summary collapse
- #deep_hash(object) ⇒ Object
-
#initialize(separator) ⇒ DeepHashConstructor
constructor
A new instance of DeepHashConstructor.
Constructor Details
#initialize(separator) ⇒ DeepHashConstructor
Returns a new instance of DeepHashConstructor.
4 5 6 |
# File 'lib/hash/deep_hash_constructor.rb', line 4 def initialize(separator) @separator = separator end |
Instance Attribute Details
#separator ⇒ Object
Returns the value of attribute separator.
2 3 4 |
# File 'lib/hash/deep_hash_constructor.rb', line 2 def separator @separator end |
Instance Method Details
#deep_hash(object) ⇒ Object
8 9 10 11 12 13 14 15 16 |
# File 'lib/hash/deep_hash_constructor.rb', line 8 def deep_hash(object) if object.is_a? Array array_deep_hash(object) elsif object.is_a? Hash hash_deep_hash(object) else object end end |