Skip to content

Instantly share code, notes, and snippets.

@devality
Created December 10, 2018 09:27
Show Gist options
  • Save devality/1546fb714a975377b08d4d57710fa2e2 to your computer and use it in GitHub Desktop.
Save devality/1546fb714a975377b08d4d57710fa2e2 to your computer and use it in GitHub Desktop.
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment