Class: Hash

Inherits:
Object
  • Object
show all
Defined in:
lib/bucky/core/test_core/test_case_loader.rb

Instance Method Summary collapse

Instance Method Details

#deep_symbolize_keys!Object



7
8
9
10
11
12
# File 'lib/bucky/core/test_core/test_case_loader.rb', line 7

def deep_symbolize_keys!
  deep_transform_keys! do |key|
    key unless key.respond_to? :to_sym
    key.to_sym
  end
end

#deep_transform_keys!(&block) ⇒ Object



14
15
16
17
18
19
20
# File 'lib/bucky/core/test_core/test_case_loader.rb', line 14

def deep_transform_keys!(&block)
  keys.each do |key|
    value = delete(key)
    self[yield(key)] = value.is_a?(Hash) ? value.deep_transform_keys!(&block) : value
  end
  self
end