Class: Descartes::Dicteng
- Inherits:
-
Object
- Object
- Descartes::Dicteng
- Includes:
- Cinch::Plugin
- Defined in:
- lib/descartes/modules/dicteng.rb
Instance Method Summary collapse
Instance Method Details
#execute(m, action, word) ⇒ Object
23 24 25 26 27 |
# File 'lib/descartes/modules/dicteng.rb', line 23 def execute(m, action, word) url = "http://www.wordreference.com/#{action}/#{word}" page = Nokogiri::HTML open(url) m.reply "#{page.xpath('//table[@class="WRD"]/tr[2]').text} di piĆ¹ qui: #{url}" end |