Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def camelize_props(hash)
- props = hash.reduce({}) do |acc, (key, value)|
- if value.respond_to?(:serializable_hash)
- acc.merge(key => value.serializable_hash)
- else
- acc.merge(key => value)
- end
- end
- props.deep_transform_keys! { |key| key.to_s.camelize(:lower) }
- props
- end
Add Comment
Please, Sign In to add comment