class User attr_accessor :used_attempts, :used_hints def initialize @used_attempts = 0 @used_hints = 0 end def name(name) return unless valid?(name) @name = name end private def valid?(name) return true if name.match(/[A-Za-z0-9_]{3,20}/) false end end