Module: Jets::Util::Camelize

Instance Method Summary collapse

Instance Method Details

#camelize(object) ⇒ Object

Not named camelize! because it conflicts with zeitwerk’s camelize!



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/jets/util/camelize.rb', line 4

def camelize(object)
  result = case object
  when Array
    object.map { |o| camelize(o) }
  when Hash
    Jets::Camelizer.transform(object).deep_symbolize_keys
  else
    object
  end

  case object
  when Symbol
    object
  when NilClass
    nil
  else
    object.replace(result)
  end
end