Class: Lita::Handlers::UrbanDictionary
- Inherits:
-
Handler
- Object
- Handler
- Lita::Handlers::UrbanDictionary
- Defined in:
- lib/lita/handlers/urban_dictionary.rb
Overview
Looks up words on Urban Dictionary.
Instance Method Summary collapse
Instance Method Details
#define(response) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/lita/handlers/urban_dictionary.rb', line 16 def define(response) term = response.matches[0][0] word, definition, example = fetch_definition(term) if word lines = "#{word}: #{definition}".split("\n") lines << "Example: #{example}" if example = (lines, term) response.reply() else response.reply("No definition found for #{term}.") end end |