Module: Sqreen::Kit::StringSanitizer

Defined in:
lib/sqreen/kit/string_sanitizer.rb

Class Method Summary collapse

Class Method Details

.sanitize(obj) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/sqreen/kit/string_sanitizer.rb', line 10

def sanitize(obj)
  case obj
  when String
    sanitize_string(obj)
  when Array
    obj.map { |e| sanitize(e) }
  when Hash
    obj.each_with_object({}) { |(k, v), h| h[sanitize(k)] = sanitize(v) }
  else
    obj
  end
end