Class: Codebreaker::Wellcome

Inherits:
Object
  • Object
show all
Includes:
InputHelper, Phrases, Storage, Validator
Defined in:
lib/entities/wellcome.rb

Constant Summary

Constants included from Validator

Validator::CB_ARRAY_SIZE, Validator::COMMANDS, Validator::GAME_NUMBER_RANGE, Validator::LEVELS, Validator::NAME_SIZE

Constants included from Storage

Storage::FILE_PATH

Instance Method Summary collapse

Methods included from InputHelper

#user_input

Methods included from Validator

#valid_input?

Methods included from Storage

#restore_storage, #save

Methods included from Phrases

#about_complexities, #about_name, #empty_statistic, #error_massage, #goodbye, #greeting, #phrase_before_guess, #phrase_lose, #phrase_win, #puts_hint, #rules, #show, #zero_hint

Instance Method Details

#registrationObject



28
29
30
31
32
33
34
# File 'lib/entities/wellcome.rb', line 28

def registration
  about_name
  name = user_input('name')
  about_complexities
  complexity = user_input('complexity')
  Console.new(name, complexity).play
end

#show_statisticsObject



23
24
25
26
# File 'lib/entities/wellcome.rb', line 23

def show_statistics
  show restore_storage
  spot
end

#spotObject



15
16
17
18
19
20
21
# File 'lib/entities/wellcome.rb', line 15

def spot
  case user_input('navigation')
  when COMMANDS[:start] then registration
  when COMMANDS[:rules] then rules
  when COMMANDS[:statistics] then show_statistics
  end
end

#start_codebreakerObject



10
11
12
13
# File 'lib/entities/wellcome.rb', line 10

def start_codebreaker
  greeting
  spot
end