module Spark::CoreExtension::Hash::InstanceMethods
Public Instance Methods
stringify_keys_with_spark!()
click to toggle source
Destructively convert all keys to strings.
# File lib/spark/ext/hash.rb, line 9 def stringify_keys_with_spark! transform_keys!{ |key| key.to_s } end
symbolize_keys_with_spark!()
click to toggle source
Destructively convert all keys to symbols, as long as they respond
# File lib/spark/ext/hash.rb, line 14 def symbolize_keys_with_spark! transform_keys!{ |key| key.to_sym rescue key } end
transform_keys_with_spark!() { |key| ... }
click to toggle source
Destructively convert all keys using the block operations. Same as transform_keys but modifies self
.
# File lib/spark/ext/hash.rb, line 20 def transform_keys_with_spark! keys.each do |key| self[yield(key)] = delete(key) end self end