lib/onebox/helpers.rb in onebox-1.7.2 vs lib/onebox/helpers.rb in onebox-1.7.3
- old
+ new
@@ -2,17 +2,11 @@
module Helpers
def self.symbolize_keys(hash)
return {} if hash.nil?
hash.inject({}){|result, (key, value)|
- new_key = case key
- when String then key.to_sym
- else key
- end
- new_value = case value
- when Hash then symbolize_keys(value)
- else value
- end
+ new_key = key.is_a?(String) ? key.to_sym : key
+ new_value = value.is_a?(Hash) ? symbolize_keys(value) : value
result[new_key] = new_value
result
}
end