Created
December 10, 2018 09:27
-
-
Save devality/1546fb714a975377b08d4d57710fa2e2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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