Class: App

Inherits:
Object
  • Object
show all
Defined in:
lib/rwpm.rb

Class Method Summary collapse

Class Method Details

.initObject



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/rwpm.rb', line 5

def self.init
    list = ["abandon","ability", "accompany", "accomplish", "account", "authority", "available", "atmosphere", "awareness", "background", "battery", "beginning"]
    correct = 0

    loop do
    word = list[rand(12)]
    puts "Type the word: #{word}".colorize(:green)
    answer = gets.chomp
    if answer == word
        correct = correct + 1
    end
    if answer != word
        puts "Fail!".colorize(:red)
    end
    puts "#{correct} Words Right".colorize(:blue)
end
end

.startObject



22
23
24
25
26
# File 'lib/rwpm.rb', line 22

def self.start

    puts "Welcome to Ruby Word Per Minute! type anything to start! (if you wanna use a timer please run rwpmt in another terminal)".colorize(:green)
    placeholder = gets.chomp
end