Class: Hashie::Mash

Inherits:
Object
  • Object
show all
Defined in:
lib/weibo.rb

Instance Method Summary collapse

Instance Method Details

#rubyify_keys!Object

Converts all of the keys to strings, optionally formatting key name



44
45
46
47
48
49
50
51
52
53
# File 'lib/weibo.rb', line 44

def rubyify_keys!
  keys.each{|k|
    v = delete(k)
    new_key = k.to_s.underscore
    self[new_key] = v
    v.rubyify_keys! if v.is_a?(Hash)
    v.each{|p| p.rubyify_keys! if p.is_a?(Hash)} if v.is_a?(Array)
  }
  self
end