Class: Hash

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

Overview

extend Hash class to turn keys into symbols

Instance Method Summary collapse

Instance Method Details

#symbolize_keys!Object

turn keys in this hash into symbols



14
15
16
17
18
19
# File 'lib/chatterbot.rb', line 14

def symbolize_keys!
  replace(inject({}) do |hash,(key,value)|
    hash[key.to_sym] = value.is_a?(Hash) ? value.symbolize_keys! : value
    hash
  end)
end