Class: Hash

Inherits:
Object
  • Object
show all
Defined in:
lib/ssource/source_kitten.rb

Instance Method Summary collapse

Instance Method Details

#purify_hashObject



5
6
7
8
9
10
11
12
13
14
# File 'lib/ssource/source_kitten.rb', line 5

def purify_hash
  hash = transform_keys do |key|
    return value unless key.start_with? 'key.'
    key[4..-1]
  end
  substructure = hash['substructure']
  return hash unless substructure
  hash['substructure'] = substructure.map(&:purify_hash)
  hash
end