class CW::Str

class Str

Public Class Methods

new() click to toggle source
# File lib/cw/str.rb, line 11
def initialize
  @seperator = ', '
end

Public Instance Methods

beginning_str() click to toggle source
# File lib/cw/str.rb, line 52
def beginning_str
  beginning = Cfg.config["begin"]
  beginning ? "Beginning:  #{stringify beginning}\n" : nil
end
containing_str() click to toggle source
# File lib/cw/str.rb, line 67
def containing_str
  containing = Cfg.config["containing"]
  containing ? "Containing: #{stringify containing}\n" : nil
end
delim_str() click to toggle source
# File lib/cw/str.rb, line 47
def delim_str
  size = Cfg.config["name"] ? Cfg.config["name"].size : 8
  "#{'=' * size}\n"
end
ending_str() click to toggle source
# File lib/cw/str.rb, line 57
def ending_str
  ending = Cfg.config["end"]
  ending ? "Ending:     #{stringify ending}\n" : nil
end
including_str() click to toggle source
# File lib/cw/str.rb, line 62
def including_str
  including = Cfg.config["including"]
  including ? "Including:  #{stringify including}\n" : nil
end
stringify(ary) click to toggle source
# File lib/cw/str.rb, line 31
def stringify ary
  ary.join(@seperator)
end
to_s() click to toggle source
# 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() click to toggle source
# File lib/cw/str.rb, line 35
def word_count_str
  "Word count: #{Cfg.config["word_count"]}\n"
end
word_size_str() click to toggle source
# File lib/cw/str.rb, line 43
def word_size_str
  Cfg.config["size"] ? "Word size:  #{Cfg.config["size"]}\n" : nil
end
wpm_str() click to toggle source
# File lib/cw/str.rb, line 39
def wpm_str
  "WPM:        #{Cfg.config["wpm"]}\n"
end