Class: WebMock::Util::ValuesStringifier

Inherits:
Object
  • Object
show all
Defined in:
lib/webmock/util/values_stringifier.rb

Class Method Summary collapse

Class Method Details

.stringify_values(value) ⇒ Object


2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/webmock/util/values_stringifier.rb', line 2

def self.stringify_values(value)
  case value
  when String, Numeric, TrueClass, FalseClass
    value.to_s
  when Hash
    Hash[
      value.map do |k, v|
        [k, stringify_values(v)]
      end
    ]
  when Array
    value.map do |v|
      stringify_values(v)
    end
  else
    value
  end
end