Sha256: 610a8ddf6a2595d2c6db2d93d31b8212d5f25bdb743eef418b6e6f89fac38916

Contents?: true

Size: 299 Bytes

Versions: 4

Compression:

Stored size: 299 Bytes

Contents

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

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
codebreaker_karolina-0.1.3 lib/modules/user.rb
codebreaker_karolina-0.1.2 lib/modules/user.rb
codebreaker_karolina-0.1.1 lib/modules/user.rb
codebreaker_karolina-0.1.0 lib/modules/user.rb