Class: CWG::Reveal

Inherits:
Tester show all
Defined in:
/Users/martyn/cw/cw_clone/lib/cw/reveal.rb

Instance Method Summary (collapse)

Methods inherited from Tester

#add_space, #audio, #audio_play, #audio_stop, #check_quit_key_input, #complete_word?, #current_word, #do_events, #finish?, #get_key_input, #get_word_last_char, #init_char_timer, #is_relevant_char?, #key_chr, #key_input, #kill_threads, #monitor_keys, #monitor_keys_thread, #move_word_to_process, #play_words_exit, #play_words_thread, #play_words_until_quit, #print, #print_letters?, #print_words, #print_words_exit, #print_words_thread, #print_words_until_quit, #process_letters, #process_space_maybe, #process_word_maybe, #process_words, #push_letter_to_current_word, #quit, #quit?, #quit_key_input?, #reset_stdin, #run, #sleep_char_delay, #spawn_play, #start_sync, #start_sync?, #stream, #sync_with_audio_player, #sync_with_play, #sync_with_print, #thread_processes, #timing, #wait_for_no_word_process, #wait_for_start_sync, #wait_player_startup_delay, #word_proc_timeout

Constructor Details

- (Reveal) initialize

Returns a new instance of Reveal



7
8
9
10
# File '/Users/martyn/cw/cw_clone/lib/cw/reveal.rb', line 7

def initialize
  @reveal_buf = ''
  puts 'Reveal mode:'
end

Instance Method Details

- (Object) build_word_maybe



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

def build_word_maybe
  @input_word ||= ''
  @input_word << key_chr if is_relevant_char?
  move_word_to_process if complete_word?
end


14
15
16
17
18
19
# File '/Users/martyn/cw/cw_clone/lib/cw/reveal.rb', line 14

def print_failed_exit_words
  until stream.stream_empty?
    @reveal_buf += stream.pop[:value] + ' '
  end
  print.success @reveal_buf
end


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

def print_marked_maybe
  @popped = stream.pop_next_marked
  if @popped
    @reveal_buf += @popped[:value] + ' '
  end
end


12
# File '/Users/martyn/cw/cw_clone/lib/cw/reveal.rb', line 12

def print_test_advice    ; print.print_advice('Test Words')    ; end

- (Object) process_input_word_maybe



21
22
23
24
25
26
# File '/Users/martyn/cw/cw_clone/lib/cw/reveal.rb', line 21

def process_input_word_maybe
  if @word_to_process
    stream.match_last_active_element @process_input_word.strip
    @process_input_word = @word_to_process = nil
  end
end

- (Object) process_letter(letr)



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

def process_letter letr
  current_word.process_letter letr
  sleep_char_delay letr
end