Module: RSpec::Parameterized::ExampleHelperMethods

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

Instance Method Summary collapse

Instance Method Details

#recursive_apply(val) ⇒ Object



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

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