Class: Descartes::Treccani

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

Instance Method Summary collapse

Instance Method Details

#citazione(m) ⇒ Object



27
28
29
30
# File 'lib/descartes/modules/treccani.rb', line 27

def citazione(m)
  treccani = Treccani::Citazione.new.get
  m.reply "#{treccani[:citazione]} - #{treccani[:autore]}"
end

#enciclopedia(m, word) ⇒ Object



32
33
34
35
36
37
38
39
# File 'lib/descartes/modules/treccani.rb', line 32

def enciclopedia(m, word)
  begin
    m.reply Treccani::Enciclopedia.new.get(word)[:meanings].first[0..400]
    m.reply "- #{Treccani::Enciclopedia.new.get_url word}"
  rescue
    m.reply 'Vocabolo non trovato.'
  end
end

#sinonimi(m, word) ⇒ Object



41
42
43
44
45
46
47
# File 'lib/descartes/modules/treccani.rb', line 41

def sinonimi(m, word)
  begin
    m.reply Treccani::Sinonimi.new.get word
  rescue
    m.reply 'Vocabolo non trovato.'
  end
end

#vocabolario(m, word) ⇒ Object



49
50
51
52
53
54
55
56
# File 'lib/descartes/modules/treccani.rb', line 49

def vocabolario(m, word)
  begin
    m.reply Treccani::Vocabolario.new.get(word)[:meanings].first[0..400]
    m.reply "- #{Treccani::Vocabolario.new.get_url word}"
  rescue
    m.reply 'Vocabolo non trovato.'
  end
end