Module: Metanorma::Utils::Array

Defined in:
lib/utils/hash_transform_keys.rb

Instance Method Summary collapse

Instance Method Details

#stringify_all_keysObject



4
5
6
7
8
9
10
11
12
13
# File 'lib/utils/hash_transform_keys.rb', line 4

def stringify_all_keys
  map do |v|
    case v
    when ::Hash, ::Array
      v.stringify_all_keys
    else
      v
    end
  end
end

#symbolize_all_keysObject



15
16
17
18
19
20
21
22
23
24
# File 'lib/utils/hash_transform_keys.rb', line 15

def symbolize_all_keys
  map do |v|
    case v
    when ::Hash, ::Array
      v.symbolize_all_keys
    else
      v
    end
  end
end