Class: Lingvo::Console::Command

Inherits:
Object
  • Object
show all
Defined in:
lib/lingvo/console/command.rb

Class Method Summary collapse

Class Method Details

.guiObject



67
68
69
# File 'lib/lingvo/console/command.rb', line 67

def gui
  GUI::Simple.run
end

.helpObject



71
72
73
# File 'lib/lingvo/console/command.rb', line 71

def help
  puts HELP
end

.notifyObject



63
64
65
# File 'lib/lingvo/console/command.rb', line 63

def notify
  GUI::Notify.run
end

.parse(path) ⇒ Object



39
40
41
42
43
44
45
46
47
48
# File 'lib/lingvo/console/command.rb', line 39

def parse(path)
  if File.exists? path
    parser = Parsers::Lingualeo.new path
    Models::English.create parser.words
    size
  else
    puts "File not found!"
    help
  end
end

.rand(count) ⇒ Object



50
51
52
53
54
55
56
57
# File 'lib/lingvo/console/command.rb', line 50

def rand(count)
  count = (count || 1).to_i

  words = Models::English.rand count
  words.each do |word|
    puts "#{word.eng} - #{word.transcr} - #{word.ru}"
  end
end

.sizeObject



59
60
61
# File 'lib/lingvo/console/command.rb', line 59

def size
  puts "You have #{Models::English.count} words"
end