Skip to content

Commit

Permalink
Added symbolize_keys for hash.
Browse files Browse the repository at this point in the history
  • Loading branch information
leanucci committed Mar 4, 2011
1 parent 563d565 commit 2cc43ad
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/bravo.rb
Expand Up @@ -3,6 +3,7 @@
require "bravo/constants"
require "savon"
require "bravo/core_ext/float"
require "bravo/core_ext/hash"
module Bravo

class NullOrInvalidAttribute < StandardError; end
Expand Down
12 changes: 12 additions & 0 deletions lib/bravo/core_ext/hash.rb
@@ -0,0 +1,12 @@
class Hash
def symbolize_keys!
keys.each do |key|
self[(key.to_sym rescue key) || key] = delete(key)
end
self
end

def symbolize_keys
dup.symbolize_keys!
end
end

0 comments on commit 2cc43ad

Please sign in to comment.