Class: Hash
- Inherits:
-
Object
- Object
- Hash
- Defined in:
- lib/bitlyr/lib/core_ext/hash.rb
Instance Method Summary collapse
- #stringify_keys ⇒ Object
- #stringify_keys! ⇒ Object
- #symbolize_keys ⇒ Object
- #symbolize_keys! ⇒ Object
- #to_query ⇒ Object
Instance Method Details
#stringify_keys ⇒ Object
13 14 15 |
# File 'lib/bitlyr/lib/core_ext/hash.rb', line 13 def stringify_keys dup.stringify_keys! end |
#stringify_keys! ⇒ Object
6 7 8 9 10 11 |
# File 'lib/bitlyr/lib/core_ext/hash.rb', line 6 def stringify_keys! keys.each do |key| self[key.to_s] = delete(key) end self end |
#symbolize_keys ⇒ Object
24 25 26 |
# File 'lib/bitlyr/lib/core_ext/hash.rb', line 24 def symbolize_keys dup.symbolize_keys! end |
#symbolize_keys! ⇒ Object
17 18 19 20 21 22 |
# File 'lib/bitlyr/lib/core_ext/hash.rb', line 17 def symbolize_keys! keys.each do |key| self[(key.to_sym rescue key) || key] = delete(key) end self end |
#to_query ⇒ Object
2 3 4 |
# File 'lib/bitlyr/lib/core_ext/hash.rb', line 2 def to_query map {|k, v|"#{k}=#{v}"}.sort * '&' end |