Class: Hash

Inherits:
Object
  • Object
show all
Defined in:
lib/subiam/ext/hash_ext.rb

Instance Method Summary collapse

Instance Method Details

#keys_to_s_recursiveObject



11
12
13
14
15
16
17
18
19
20
21
# File 'lib/subiam/ext/hash_ext.rb', line 11

def keys_to_s_recursive
  new_one = {}
  self.each do |key, elem|
    if elem.respond_to? :keys_to_s_recursive
      new_one[key.to_s] = elem.keys_to_s_recursive
      next
    end
    new_one[key.to_s] = elem
  end
  new_one
end

#sort_array!Object



2
3
4
5
6
7
8
9
# File 'lib/subiam/ext/hash_ext.rb', line 2

def sort_array!
  keys.each do |key|
    value = self[key]
    self[key] = sort_array0(value)
  end

  self
end