Class: Descartes::MusicToughts

Inherits:
Object
  • Object
show all
Includes:
Cinch::Plugin
Defined in:
lib/descartes/modules/musicthoughts.rb

Instance Method Summary collapse

Instance Method Details

#execute(m) ⇒ Object



23
24
25
26
27
28
29
30
31
32
# File 'lib/descartes/modules/musicthoughts.rb', line 23

def execute(m)
  lang = { 'Cookie' => 'lang=it' }
  page = Nokogiri::HTML open('http://musicthoughts.com/t', lang)

  quote  = page.at_xpath('//blockquote//q').text.strip
  author = page.at_xpath('//blockquote//cite').text.strip

  m.reply quote
  m.reply "- #{author}"
end