Class: CWG::CurrentWord

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

Instance Method Summary (collapse)

Methods included from TextHelpers

#cw_chars, #exclude_non_cw_chars, #letter_group, #number_group

Constructor Details

- (CurrentWord) initialize

Returns a new instance of CurrentWord



9
10
11
# File '/Users/martyn/cw/cw_clone/lib/cw/current_word.rb', line 9

def initialize
  @current_word = ''
end

Instance Method Details

- (Object) clear



25
26
27
28
# File '/Users/martyn/cw/cw_clone/lib/cw/current_word.rb', line 25

def clear
  @current_word.clear
  @current_word = ''
end

- (Object) current_word



13
14
15
# File '/Users/martyn/cw/cw_clone/lib/cw/current_word.rb', line 13

def current_word
  @current_word ||= String.new
end

- (Object) process_letter(letr)



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

def process_letter letr
  letr.downcase!
  push_letter letr
end

- (Object) push_letter(letr)



17
18
19
# File '/Users/martyn/cw/cw_clone/lib/cw/current_word.rb', line 17

def push_letter letr
  @current_word += letr
end

- (Object) strip



30
31
32
# File '/Users/martyn/cw/cw_clone/lib/cw/current_word.rb', line 30

def strip
  @current_word.strip!
end

- (Object) to_s



21
22
23
# File '/Users/martyn/cw/cw_clone/lib/cw/current_word.rb', line 21

def to_s
  @current_word
end