Class: CWG::Str

Inherits:
Object
  • Object
show all
Includes:
TextHelpers
Defined in:
/Users/martyn/cw/cw_clone/lib/cw/str.rb

Overview

class Str

Instance Method Summary (collapse)

Methods included from TextHelpers

#cw_chars, #exclude_non_cw_chars, #letter_group, #number_group

Constructor Details

- (Str) initialize

Returns a new instance of Str



11
12
13
# File '/Users/martyn/cw/cw_clone/lib/cw/str.rb', line 11

def initialize
  @seperator = ', '
end

Instance Method Details

- (Object) beginning_str



35
36
37
38
# File '/Users/martyn/cw/cw_clone/lib/cw/str.rb', line 35

def beginning_str
  beginning = Params.begin
  beginning ? "Beginning:  #{stringify beginning}\n" : nil
end

- (Object) containing_str



50
51
52
53
# File '/Users/martyn/cw/cw_clone/lib/cw/str.rb', line 50

def containing_str
  containing = Params.containing
  containing ? "Containing: #{stringify containing}\n" : nil
end

- (Object) ending_str



40
41
42
43
# File '/Users/martyn/cw/cw_clone/lib/cw/str.rb', line 40

def ending_str
  ending = Params.end
  ending ? "Ending:     #{stringify ending}\n" : nil
end

- (Object) including_str



45
46
47
48
# File '/Users/martyn/cw/cw_clone/lib/cw/str.rb', line 45

def including_str
  including = Params.including
  including ? "Including:  #{stringify including}\n" : nil
end

- (Object) stringify(ary)



31
32
33
# File '/Users/martyn/cw/cw_clone/lib/cw/str.rb', line 31

def stringify ary
  ary.join(@seperator)
end

- (Object) to_s



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File '/Users/martyn/cw/cw_clone/lib/cw/str.rb', line 15

def to_s
  delim  = Params.delim_str
  [
    Params.name + "\n",
    delim,
    Params.wpm_str,
    Params.word_count_str,
    Params.word_size_str,
    beginning_str,
    ending_str,
    including_str,
    containing_str,
    delim
  ].collect{ |prm| prm.to_s }.join
end