cw 0.2.2 → 0.2.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +3 -3
- data/.travis.yml +1 -1
- data/README.md +16 -40
- data/Rakefile +4 -0
- data/VERSION +1 -0
- data/bin/cw +44 -0
- data/cw.gemspec +8 -5
- data/data/text/{adv_of_sh_holmes.txt → book.txt} +4 -4
- data/example.rb +17 -17
- data/lib/cw.rb +53 -18
- data/lib/cw/alphabet.rb +37 -0
- data/lib/cw/audio_player.rb +31 -3
- data/lib/cw/book.rb +14 -7
- data/lib/cw/book_details.rb +2 -2
- data/lib/cw/cl.rb +11 -2
- data/lib/cw/config_file.rb +69 -0
- data/lib/cw/cw_dsl.rb +19 -57
- data/lib/cw/monitor_keys.rb +1 -1
- data/lib/cw/params.rb +104 -0
- data/lib/cw/print.rb +19 -23
- data/lib/cw/repeat_word.rb +2 -2
- data/lib/cw/reveal.rb +47 -0
- data/lib/cw/sentence.rb +22 -2
- data/lib/cw/test_words.rb +1 -1
- data/lib/cw/tester.rb +17 -4
- data/lib/cw/timing.rb +1 -1
- data/lib/cw/tone_generator.rb +2 -2
- data/lib/cw/words.rb +20 -1
- data/test/test_cw.rb +8 -11
- data/test/test_tester.rb +62 -0
- metadata +30 -14
- data/classes.svg +0 -145
- data/classes.svg.dot +0 -360
- data/daily.rb +0 -182
- data/data/text/progress.txt +0 -1
- data/lib/cw/cw_params.rb +0 -50
data/daily.rb
DELETED
@@ -1,182 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
now = Time.now
|
4
|
-
|
5
|
-
require_relative 'lib/cw'
|
6
|
-
|
7
|
-
speed = 15
|
8
|
-
|
9
|
-
CW.new do
|
10
|
-
shuffle
|
11
|
-
wpm speed
|
12
|
-
ewpm speed - 2
|
13
|
-
word_count 5
|
14
|
-
test_letters
|
15
|
-
end
|
16
|
-
|
17
|
-
CW.new do
|
18
|
-
shuffle
|
19
|
-
wpm speed
|
20
|
-
word_count 15
|
21
|
-
test_letters
|
22
|
-
end
|
23
|
-
|
24
|
-
speed += 5
|
25
|
-
|
26
|
-
CW.new do
|
27
|
-
wpm speed
|
28
|
-
load_abbreviations
|
29
|
-
shuffle
|
30
|
-
repeat_word
|
31
|
-
end
|
32
|
-
|
33
|
-
CW.new do
|
34
|
-
wpm speed
|
35
|
-
load_abbreviations
|
36
|
-
shuffle
|
37
|
-
repeat_word
|
38
|
-
end
|
39
|
-
|
40
|
-
CW.new do
|
41
|
-
wpm speed
|
42
|
-
load_most_common_words
|
43
|
-
word_count 40
|
44
|
-
shuffle
|
45
|
-
repeat_word
|
46
|
-
end
|
47
|
-
|
48
|
-
|
49
|
-
CW.new do
|
50
|
-
wpm speed
|
51
|
-
load_most_common_words
|
52
|
-
word_count 40
|
53
|
-
shuffle
|
54
|
-
double_words
|
55
|
-
test_letters
|
56
|
-
end
|
57
|
-
|
58
|
-
|
59
|
-
speed -= 5
|
60
|
-
|
61
|
-
CW.new do
|
62
|
-
wpm speed
|
63
|
-
play_book output: :letter, duration: 2
|
64
|
-
end
|
65
|
-
|
66
|
-
CW.new do
|
67
|
-
wpm speed
|
68
|
-
read_rss(:reuters, 2)
|
69
|
-
end
|
70
|
-
|
71
|
-
speed += 15
|
72
|
-
|
73
|
-
CW.new do
|
74
|
-
wpm speed
|
75
|
-
load_alphabet
|
76
|
-
shuffle
|
77
|
-
repeat_word
|
78
|
-
end
|
79
|
-
|
80
|
-
CW.new do
|
81
|
-
2.times do
|
82
|
-
wpm speed
|
83
|
-
load_numbers
|
84
|
-
shuffle
|
85
|
-
repeat_word
|
86
|
-
end
|
87
|
-
end
|
88
|
-
|
89
|
-
speed -= 10
|
90
|
-
|
91
|
-
CW.new do
|
92
|
-
load_words 'data/text/cw_conversation.txt'
|
93
|
-
wpm speed
|
94
|
-
print_letters
|
95
|
-
end
|
96
|
-
|
97
|
-
seconds = (Time.now - now).to_i
|
98
|
-
|
99
|
-
if seconds == 0
|
100
|
-
puts 'No tests run!'
|
101
|
-
else
|
102
|
-
minutes = 0
|
103
|
-
if seconds >= 60
|
104
|
-
minutes = (seconds / 60).to_i
|
105
|
-
seconds = seconds % 60
|
106
|
-
end
|
107
|
-
print "Daily run completed in "
|
108
|
-
print "#{minutes} minute" if minutes > 0
|
109
|
-
print 's' if minutes > 1
|
110
|
-
print ', ' if((seconds > 0) && (minutes > 0))
|
111
|
-
print "#{seconds} second" if seconds > 0
|
112
|
-
print 's' if seconds > 1
|
113
|
-
puts '.'
|
114
|
-
end
|
115
|
-
|
116
|
-
#if seconds >
|
117
|
-
#puts "Daily run completed in #{().to_i} seconds"
|
118
|
-
#
|
119
|
-
#CW.new do
|
120
|
-
# shuffle
|
121
|
-
# use_ebook2cw
|
122
|
-
## ewpm 18
|
123
|
-
# wpm 30
|
124
|
-
# words_no_longer_than 3
|
125
|
-
# word_count 25
|
126
|
-
## words = "ABC"
|
127
|
-
## test_words
|
128
|
-
## test_letters
|
129
|
-
## play_book
|
130
|
-
# repeat_word
|
131
|
-
# #print_letters
|
132
|
-
#end
|
133
|
-
|
134
|
-
#CW.new do
|
135
|
-
## shuffle
|
136
|
-
# wpm 15
|
137
|
-
# word_count 5
|
138
|
-
## test_letters
|
139
|
-
# #print_letters
|
140
|
-
#end
|
141
|
-
|
142
|
-
# CW.new do
|
143
|
-
# shuffle
|
144
|
-
# wpm 18
|
145
|
-
# ewpm 15
|
146
|
-
# word_count 15
|
147
|
-
# #print_letters
|
148
|
-
# end
|
149
|
-
#
|
150
|
-
# CW.new do
|
151
|
-
# shuffle
|
152
|
-
# wpm 18
|
153
|
-
# ewpm 15
|
154
|
-
# word_count 15
|
155
|
-
# #print_letters
|
156
|
-
# end
|
157
|
-
#
|
158
|
-
# CW.new do
|
159
|
-
# shuffle
|
160
|
-
# wpm 18
|
161
|
-
# ewpm 15
|
162
|
-
# word_count 15
|
163
|
-
# #print_letters
|
164
|
-
# end
|
165
|
-
#
|
166
|
-
# CW.new do
|
167
|
-
# shuffle
|
168
|
-
# wpm 18
|
169
|
-
# ewpm 15
|
170
|
-
# word_count 15
|
171
|
-
# #print_letters
|
172
|
-
# end
|
173
|
-
#
|
174
|
-
# CW.new do
|
175
|
-
# shuffle
|
176
|
-
# wpm 18
|
177
|
-
# ewpm 15
|
178
|
-
# word_count 15
|
179
|
-
# #print_letters
|
180
|
-
# end
|
181
|
-
#
|
182
|
-
#
|
data/data/text/progress.txt
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
0
|
data/lib/cw/cw_params.rb
DELETED
@@ -1,50 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
module Params
|
4
|
-
|
5
|
-
extend self
|
6
|
-
|
7
|
-
def param_method values, name
|
8
|
-
value = values.first
|
9
|
-
value ? self.send("#{name}=", value) : instance_variable_get("@#{name}")
|
10
|
-
end
|
11
|
-
|
12
|
-
def param_internal name
|
13
|
-
attr_accessor name
|
14
|
-
instance_variable_set("@#{name}", nil)
|
15
|
-
define_method name do | * values|
|
16
|
-
param_method values, name
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
def param( * names)
|
21
|
-
names.each do |name|
|
22
|
-
param_internal name
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
def config( & block)
|
27
|
-
instance_eval( & block)
|
28
|
-
end
|
29
|
-
|
30
|
-
def shuffle_str
|
31
|
-
shuffle ? "Shuffle: #{shuffle ? 'yes' : 'no'}\n" : nil
|
32
|
-
end
|
33
|
-
|
34
|
-
def word_count_str
|
35
|
-
word_count ? "Word count: #{word_count}\n" : nil
|
36
|
-
end
|
37
|
-
|
38
|
-
def wpm_str
|
39
|
-
"WPM: #{wpm}\n"
|
40
|
-
end
|
41
|
-
|
42
|
-
def word_size_str
|
43
|
-
size ? "Word size: #{size}\n" : nil
|
44
|
-
end
|
45
|
-
|
46
|
-
def delim_str
|
47
|
-
"#{'=' * Params.name.size}\n"
|
48
|
-
end
|
49
|
-
|
50
|
-
end
|