Class: Lingvo::Console::Command
- Inherits:
-
Object
- Object
- Lingvo::Console::Command
- Defined in:
- lib/lingvo/console/command.rb
Class Method Summary collapse
- .file_not_found ⇒ Object
- .gui ⇒ Object
- .help ⇒ Object
- .notify ⇒ Object
- .parse(path) ⇒ Object
- .rand(count) ⇒ Object
- .size ⇒ Object
- .version ⇒ Object
- .words_counter(from, to) ⇒ Object
- .words_not_found ⇒ Object
Class Method Details
.file_not_found ⇒ Object
100 101 102 |
# File 'lib/lingvo/console/command.rb', line 100 def file_not_found puts "\nFile not found!" end |
.help ⇒ Object
92 93 94 |
# File 'lib/lingvo/console/command.rb', line 92 def help puts HELP end |
.notify ⇒ Object
84 85 86 |
# File 'lib/lingvo/console/command.rb', line 84 def notify GUI::Notify.run end |
.parse(path) ⇒ Object
62 63 64 65 66 |
# File 'lib/lingvo/console/command.rb', line 62 def parse(path) return file_not_found unless File.exists? path Parsers::Lingualeo.new(path) { |word| Models::English.create word } size end |
.rand(count) ⇒ Object
73 74 75 76 77 78 |
# File 'lib/lingvo/console/command.rb', line 73 def rand(count) return words_not_found unless Models::English.any? Models::English.rand((count || 1).to_i).each do |word| printf "%-20s %-20s %s\n", word.eng, word.transcr, word.ru end end |
.size ⇒ Object
80 81 82 |
# File 'lib/lingvo/console/command.rb', line 80 def size puts "\nYou have #{Models::English.count} words" end |
.version ⇒ Object
96 97 98 |
# File 'lib/lingvo/console/command.rb', line 96 def version puts "\n#{VERSION}" end |
.words_counter(from, to) ⇒ Object
68 69 70 71 |
# File 'lib/lingvo/console/command.rb', line 68 def words_counter(from, to) return file_not_found unless File.exists? from Parsers::WordsCounter.new from, to end |
.words_not_found ⇒ Object
104 105 106 |
# File 'lib/lingvo/console/command.rb', line 104 def words_not_found puts "\nYou don't have any words" end |