Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- module Definition
- def self.get_definition(m, word)
- m.reply(self.define(word) || 'No definition found.', true)
- end
- def self.define(word)
- url = "http://www.urbandictionary.com/define.php?term=#{CGI.escape(query)}"
- CGI.unescape_html Nokogiri::HTML(open(url)).at("div.definition").text.gsub(/\s+/, ' ') rescue nil
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment