Guest User

Untitled

a guest
Dec 10th, 2018
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.33 KB | None | 0 0
  1. def camelize_props(hash)
  2. props = hash.reduce({}) do |acc, (key, value)|
  3. if value.respond_to?(:serializable_hash)
  4. acc.merge(key => value.serializable_hash)
  5. else
  6. acc.merge(key => value)
  7. end
  8. end
  9.  
  10. props.deep_transform_keys! { |key| key.to_s.camelize(:lower) }
  11.  
  12. props
  13. end
Add Comment
Please, Sign In to add comment