Class: Lita::Handlers::Wordnik
- Inherits:
-
Handler
- Object
- Handler
- Lita::Handlers::Wordnik
- Defined in:
- lib/lita/handlers/wordnik.rb
Constant Summary collapse
- NO_RESULTS =
"Wordnik doesn't have any results for that."
Class Method Summary collapse
Class Method Details
.default_config(config) ⇒ Object
8 9 10 |
# File 'lib/lita/handlers/wordnik.rb', line 8 def self.default_config(config) config.api_key = nil end |
.define_wordnik_method(name, getter_name) ⇒ Object
29 30 31 32 33 34 35 36 |
# File 'lib/lita/handlers/wordnik.rb', line 29 def define_wordnik_method(name, getter_name) define_method(name) do |response| return unless validate(response) word = encode_word(response.matches[0][0]) result = send(getter_name, word) response.reply(result) end end |