Class: Hash

Inherits:
Object
  • Object
show all
Defined in:
lib/bitly_oauth/lib/core_ext/hash.rb

Direct Known Subclasses

ParamsHash

Instance Method Summary collapse

Instance Method Details

#stringify_keysObject



9
10
11
# File 'lib/bitly_oauth/lib/core_ext/hash.rb', line 9

def stringify_keys
  dup.stringify_keys!
end

#stringify_keys!Object



2
3
4
5
6
7
# File 'lib/bitly_oauth/lib/core_ext/hash.rb', line 2

def stringify_keys!
  keys.each do |key|
    self[key.to_s] = delete(key)
  end
  self
end

#symbolize_keysObject



20
21
22
# File 'lib/bitly_oauth/lib/core_ext/hash.rb', line 20

def symbolize_keys
  dup.symbolize_keys!
end

#symbolize_keys!Object



13
14
15
16
17
18
# File 'lib/bitly_oauth/lib/core_ext/hash.rb', line 13

def symbolize_keys!
  keys.each do |key|
    self[(key.to_sym rescue key) || key] = delete(key)
  end
  self
end