Class: Object

Inherits:
BasicObject
Defined in:
lib/string.rb

Instance Method Summary collapse

Instance Method Details

#convert_keys(&blk) ⇒ Object



18
19
20
21
22
23
24
25
26
27
# File 'lib/string.rb', line 18

def convert_keys(&blk)
  case self
    when Array
      self.map { |v| v.convert_keys(&blk) }
    when Hash
      self.map { |k, v| [blk.call(k), v.convert_keys(&blk)] }.to_h
    else
      self
  end
end