lib/console.rb in codebreaker_paratskiy-0.2.2 vs lib/console.rb in codebreaker_paratskiy-0.2.3
- old
+ new
@@ -1,11 +1,11 @@
require_relative 'codebreaker_paratskiy'
class Console
include CodebreakerParatskiy
include Validating
include Output
- attr_accessor :user_code, :game
+ attr_accessor :user_code
def initialize
@user_code = []
end
@@ -62,11 +62,11 @@
puts result
result
end
def registration
- @game = CodebreakerParatskiy.run_game(_get_name, _get_difficulty_level)
+ CodebreakerParatskiy.run_game(_get_name, _get_difficulty_level)
end
def _get_name
show_msg(:EnterName)
answer = user_enter
@@ -78,11 +78,11 @@
end
def _get_difficulty_level
show_msg(:EnterDifficulty)
answer = user_enter
- return DIFFICULTIES[answer.to_sym] if DIFFICULTIES.include?(answer.to_sym)
+ return answer if DIFFICULTIES.include?(answer.to_sym)
show_msg(:InvalidCommand)
_get_difficulty_level
end
@@ -112,7 +112,11 @@
enter
end
def exit?(answer)
answer == EXIT_COMMAND
+ end
+
+ def game
+ CurrentGame.game
end
end