class CodebreakerGame::User
Attributes
attempts_used[R]
difficulty[R]
hints_used[R]
name[R]
Public Class Methods
new(name, difficulty)
click to toggle source
# File lib/codebreaker_game/entities/user.rb, line 5 def initialize(name, difficulty) @name = name @difficulty = difficulty @hints_used = 0 @attempts_used = 0 end
Public Instance Methods
attempt()
click to toggle source
# File lib/codebreaker_game/entities/user.rb, line 22 def attempt @attempts_used += 1 end
attempts?()
click to toggle source
# File lib/codebreaker_game/entities/user.rb, line 34 def attempts? @attempts_used < @difficulty.attempts end
attempts_total()
click to toggle source
# File lib/codebreaker_game/entities/user.rb, line 18 def attempts_total @difficulty.attempts end
hint()
click to toggle source
# File lib/codebreaker_game/entities/user.rb, line 26 def hint @hints_used += 1 end
hints?()
click to toggle source
# File lib/codebreaker_game/entities/user.rb, line 30 def hints? @hints_used < @difficulty.hints end
hints_total()
click to toggle source
# File lib/codebreaker_game/entities/user.rb, line 14 def hints_total @difficulty.hints end