Sha256: 3bc974a3ea5b13d1fb8b3166dab9ba09e2a86c1e08f26a60485ad7e8321b51e7

Contents?: true

Size: 274 Bytes

Versions: 5

Compression:

Stored size: 274 Bytes

Contents

class User
  attr_accessor :used_attempts, :used_hints
  attr_reader :name

  def initialize(name)
    return unless valid?(name)

    @name = name
    @used_attempts = 0
    @used_hints = 0
  end

  private

  def valid?(name)
    !!name[/\A[A-Za-z0-9]{3,20}\z/]
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
codebreaker_karolina-0.1.9 lib/modules/user.rb
codebreaker_karolina-0.1.8 lib/modules/user.rb
codebreaker_karolina-0.1.7 lib/modules/user.rb
codebreaker_karolina-0.1.6 lib/modules/user.rb
codebreaker_karolina-0.1.5 lib/modules/user.rb