Class: ReactWebpackRails::Services::CamelizeKeys

Inherits:
Object
  • Object
show all
Defined in:
lib/react_webpack_rails/services/camelize_keys.rb

Class Method Summary collapse

Class Method Details

.call(props) ⇒ Object



4
5
6
7
8
9
10
# File 'lib/react_webpack_rails/services/camelize_keys.rb', line 4

def self.call(props)
  return props unless props.is_a?(Hash)
  props.inject({}) do |h, (k, v)|
    h[k.to_s.camelize(:lower)] = v.is_a?(Hash) ? self.call(v) : v
    h
  end
end