diff options
Diffstat (limited to 'lib/hashie/extensions/mash/symbolize_keys.rb')
-rw-r--r-- | lib/hashie/extensions/mash/symbolize_keys.rb | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/hashie/extensions/mash/symbolize_keys.rb b/lib/hashie/extensions/mash/symbolize_keys.rb index 91a6b14..c0f2a4d 100644 --- a/lib/hashie/extensions/mash/symbolize_keys.rb +++ b/lib/hashie/extensions/mash/symbolize_keys.rb @@ -5,7 +5,7 @@ module Hashie # # @example # class LazyResponse < Hashie::Mash - # include Hashie::Extensions::Mash::SymbolizedKeys + # include Hashie::Extensions::Mash::SymbolizeKeys # end # # response = LazyResponse.new("id" => 123, "name" => "Rey").to_h @@ -24,13 +24,13 @@ module Hashie private - # Converts a key to a symbol + # Converts a key to a symbol, if possible # # @api private - # @param [String, Symbol] key the key to convert to a symbol - # @return [void] + # @param [<K>] key the key to attempt convert to a symbol + # @return [Symbol, K] def convert_key(key) - key.to_sym + key.respond_to?(:to_sym) ? key.to_sym : key end end end |