class Codebreaker::Representer
Public Class Methods
empty_db_msg()
click to toggle source
# File lib/app/entities/representer.rb, line 54 def empty_db_msg puts I18n.t('console.empty_db') end
error_msg(error)
click to toggle source
# File lib/app/entities/representer.rb, line 70 def error_msg(error) puts I18n.t('error', error: error) end
goodbye()
click to toggle source
# File lib/app/entities/representer.rb, line 10 def goodbye puts I18n.t(:goodbye) end
greeting_msg()
click to toggle source
# File lib/app/entities/representer.rb, line 6 def greeting_msg puts I18n.t('console.greeting') end
lose_msg()
click to toggle source
# File lib/app/entities/representer.rb, line 50 def lose_msg puts I18n.t('console.lose') end
make_guess_msg()
click to toggle source
# File lib/app/entities/representer.rb, line 27 def make_guess_msg puts I18n.t('console.make_guess') end
round_info_text(result, attempts, hints)
click to toggle source
# File lib/app/entities/representer.rb, line 39 def round_info_text(result, attempts, hints) puts I18n.t('console.result', result: result) puts I18n.t('console.left_attempts_and_hints', attempts: attempts, hints: hints) puts I18n.t('console.make_guess') puts I18n.t('console.enter_hint') if hints.positive? end
select_difficulty_msg()
click to toggle source
# File lib/app/entities/representer.rb, line 23 def select_difficulty_msg puts I18n.t('console.select_difficulty', difficults: Difficulty::DIFFICULTIES.keys.join(', ')) end
show_db(loaded_db)
click to toggle source
# File lib/app/entities/representer.rb, line 58 def show_db(loaded_db) sort_db(loaded_db).each_with_index do |user, index| puts I18n.t('console.stats_user_info', position: index + 1, name: user[:name], level: user[:level]) puts I18n.t('console.stats_lefts', attempts: user[:left_attempts], all_attempts: user[:all_attempts], hints: user[:left_hints], all_hints: user[:all_hints]) end end
show_rules()
click to toggle source
# File lib/app/entities/representer.rb, line 66 def show_rules puts I18n.t('console.rules') end
showed_hint_msg(showed)
click to toggle source
# File lib/app/entities/representer.rb, line 31 def showed_hint_msg(showed) puts I18n.t('console.showed_hint', showed: showed) end
sort_db(loaded_db)
click to toggle source
# File lib/app/entities/representer.rb, line 74 def sort_db(loaded_db) loaded_db.sort_by { |user| [user[:all_attempts], -user[:left_attempts], -user[:left_hints]] } end
what_name_msg()
click to toggle source
# File lib/app/entities/representer.rb, line 19 def what_name_msg puts I18n.t('console.what_name') end
what_next_text()
click to toggle source
# File lib/app/entities/representer.rb, line 14 def what_next_text puts I18n.t('console.choose_the_command', stats: Console::COMMANDS[:stats], rules: Console::COMMANDS[:rules], start: Console::COMMANDS[:start], exit: Console::COMMANDS[:exit]) end
win_msg()
click to toggle source
# File lib/app/entities/representer.rb, line 46 def win_msg puts I18n.t('console.win', yes: Console::ACCEPT_SAVING_RESULT) end
zero_hints_msg()
click to toggle source
# File lib/app/entities/representer.rb, line 35 def zero_hints_msg puts I18n.t('console.zero_hints') end