class BeforeGame::Hint
Attributes
hints_count[RW]
hints_items[RW]
Public Class Methods
new(hints_count:)
click to toggle source
# File lib/codebreaker/before_game/hint.rb, line 7 def initialize(hints_count:) @hints_count = hints_count end
Public Instance Methods
generate_hints(code)
click to toggle source
# File lib/codebreaker/before_game/hint.rb, line 11 def generate_hints(code) @hints_items = code.sample(@hints_count) end
hint()
click to toggle source
# File lib/codebreaker/before_game/hint.rb, line 15 def hint return false if @hints_count.zero? @hints_items.pop end