Sha256: 7c2d514dd04dbd145681d5b09b1ebd692cd454ce5af7ad07d551b655ea315996
Contents?: true
Size: 551 Bytes
Versions: 5
Compression:
Stored size: 551 Bytes
Contents
# -*- encoding: utf-8 -*- class ::Hash def uncamelize_and_symbolize_keys self.uncamelize_and_stringify_keys.symbolize_keys end def uncamelize_and_stringify_keys uncamelized = {} self.each_pair do |key, value| new_key = key.to_s.split(/(?=[A-Z])/).join('_').downcase uncamelized[new_key] = value end uncamelized end def symbolize_keys symbolized = {} self.each_pair do |key, value| symbolized[key.to_sym] = value end symbolized end unless self.method_defined?(:symbolize_keys) end
Version data entries
5 entries across 5 versions & 1 rubygems
Version | Path |
---|---|
stomp-1.2.4 | lib/stomp/ext/hash.rb |
stomp-1.2.3 | lib/stomp/ext/hash.rb |
stomp-1.2.2 | lib/stomp/ext/hash.rb |
stomp-1.2.1 | lib/stomp/ext/hash.rb |
stomp-1.2.0 | lib/stomp/ext/hash.rb |