Sha256: cbc36f158870d0902bcb091898e9da1926cb6d77ece50eae150ddbf85cf98398

Contents?: true

Size: 466 Bytes

Versions: 2

Compression:

Stored size: 466 Bytes

Contents

# frozen_string_literal: true

class User < BaseClass
  VALID_NAME_RANGE = (3..20).freeze
  VALID_SYMBOLS_RANGE = ('a'..'z').freeze

  attr_accessor :name
  attr_reader :errors

  def initialize(name = 'Codebreaker')
    @name = name
    @errors = []
  end

  def validate
    @errors << 'error_name_length' unless check_length_in_range?(@name, VALID_NAME_RANGE)
    @errors << 'error_name_chars' unless check_symbols_in_range?(@name, VALID_SYMBOLS_RANGE)
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
codebreaker_gapdn-0.1.1 lib/entities/user.rb
codebreaker_gapdn-0.1.0 lib/entities/user.rb