class Ruboty::BrainDictionary::Actions::Learn

Public Instance Methods

call() click to toggle source
# File lib/ruboty/brain_dictionary/actions/learn.rb, line 7
def call
  message.reply(learn)
end

Private Instance Methods

learn() click to toggle source
# File lib/ruboty/brain_dictionary/actions/learn.rb, line 13
def learn
  dict = BrainDictionaryHelper.dictionary(message.robot)
  key = message[:key]
  dict[key] = message[:value]
  "I learn #{key}:#{message[:value]}"
rescue => e
  e.message
end