lib/modules/user.rb in codebreaker_karolina-0.1.3 vs lib/modules/user.rb in codebreaker_karolina-0.1.4
- old
+ new
@@ -1,16 +1,14 @@
class User
attr_accessor :used_attempts, :used_hints
+ attr_reader :name
- def initialize
- @used_attempts = 0
- @used_hints = 0
- end
-
- def name(name)
+ def initialize(name)
return unless valid?(name)
@name = name
+ @used_attempts = 0
+ @used_hints = 0
end
private
def valid?(name)