Module: RSpec::Parameterized::Core::ExampleHelperMethods

Defined in:
lib/rspec/parameterized/core/example_helper_methods.rb

Instance Method Summary collapse

Instance Method Details

#recursive_apply(val) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/rspec/parameterized/core/example_helper_methods.rb', line 5

def recursive_apply(val)
  return val.apply(self) if HelperMethods.applicable?(val)

  if val.is_a?(Array)
    return val.map { |child_val| recursive_apply(child_val) }
  end

  if val.is_a?(Hash)
    return val.map { |key, value| [recursive_apply(key), recursive_apply(value)] }.to_h
  end

  val
end