Guest User

Untitled

a guest
Nov 19th, 2013
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 0.34 KB | None | 0 0
  1. module Definition
  2.   def self.get_definition(m, word)
  3.     m.reply(self.define(word) || 'No definition found.', true)
  4.   end
  5.    
  6.   def self.define(word)
  7.     url = "http://www.urbandictionary.com/define.php?term=#{CGI.escape(query)}"
  8.     CGI.unescape_html Nokogiri::HTML(open(url)).at("div.definition").text.gsub(/\s+/, ' ') rescue nil
  9.   end
  10. end
Advertisement
Add Comment
Please, Sign In to add comment