Class: Darthjee::CoreExt::Hash::DeepHashConstructor

Inherits:
Object
  • Object
show all
Defined in:
lib/darthjee/core_ext/hash/deep_hash_constructor.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(separator) ⇒ DeepHashConstructor

Returns a new instance of DeepHashConstructor.



9
10
11
# File 'lib/darthjee/core_ext/hash/deep_hash_constructor.rb', line 9

def initialize(separator)
  @separator = separator
end

Instance Attribute Details

#separatorObject

Returns the value of attribute separator.



7
8
9
# File 'lib/darthjee/core_ext/hash/deep_hash_constructor.rb', line 7

def separator
  @separator
end

Instance Method Details

#deep_hash(object) ⇒ Object



13
14
15
16
17
18
19
20
21
# File 'lib/darthjee/core_ext/hash/deep_hash_constructor.rb', line 13

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