Class: CW::Str
Overview
Instance Method Summary
collapse
#cw_chars, #exclude_non_cw_chars, #letter_group, #number_group
Constructor Details
#initialize ⇒ Str
Returns a new instance of Str.
11
12
13
|
# File 'lib/cw/str.rb', line 11
def initialize
@seperator = ', '
end
|
Instance Method Details
#beginning_str ⇒ Object
52
53
54
55
|
# File 'lib/cw/str.rb', line 52
def beginning_str
beginning = Cfg.config["begin"]
beginning ? "Beginning: #{stringify beginning}\n" : nil
end
|
#containing_str ⇒ Object
67
68
69
70
|
# File 'lib/cw/str.rb', line 67
def containing_str
containing = Cfg.config["containing"]
containing ? "Containing: #{stringify containing}\n" : nil
end
|
#delim_str ⇒ Object
47
48
49
50
|
# File 'lib/cw/str.rb', line 47
def delim_str
size = Cfg.config["name"] ? Cfg.config["name"].size : 8
"#{'=' * size}\n"
end
|
#ending_str ⇒ Object
57
58
59
60
|
# File 'lib/cw/str.rb', line 57
def ending_str
ending = Cfg.config["end"]
ending ? "Ending: #{stringify ending}\n" : nil
end
|
#including_str ⇒ Object
62
63
64
65
|
# File 'lib/cw/str.rb', line 62
def including_str
including = Cfg.config["including"]
including ? "Including: #{stringify including}\n" : nil
end
|
#stringify(ary) ⇒ Object
31
32
33
|
# File 'lib/cw/str.rb', line 31
def stringify ary
ary.join(@seperator)
end
|
#to_s ⇒ Object
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
# File 'lib/cw/str.rb', line 15
def to_s
delim = delim_str
[
("#{Cfg.config["name"]}\n" if(Cfg.config["name"])),
delim,
wpm_str,
word_count_str,
word_size_str,
beginning_str,
ending_str,
including_str,
containing_str,
delim
].collect{ |prm| prm.to_s }.join
end
|
#word_count_str ⇒ Object
35
36
37
|
# File 'lib/cw/str.rb', line 35
def word_count_str
"Word count: #{Cfg.config["word_count"]}\n"
end
|
#word_size_str ⇒ Object
43
44
45
|
# File 'lib/cw/str.rb', line 43
def word_size_str
Cfg.config["size"] ? "Word size: #{Cfg.config["size"]}\n" : nil
end
|
#wpm_str ⇒ Object
39
40
41
|
# File 'lib/cw/str.rb', line 39
def wpm_str
"WPM: #{Cfg.config["wpm"]}\n"
end
|