Sha256: e435d6bc953e58756a0f860c18c574974637e590d7d2c19b63eacd72fea32d75

Contents?: true

Size: 381 Bytes

Versions: 2

Compression:

Stored size: 381 Bytes

Contents

# frozen_string_literal: true

module AndriiCodebreaker
  class User
    include Constant

    attr_reader :name

    def initialize(name)
      @name = validates_name(name)
    end

    private

    def validates_name(name)
      name if valid_name?(name)
    end

    def valid_name?(name)
      name.length >= NAME_MIN_LENGTH && name.length <= NAME_MAX_LENGTH
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
andrii_codebreaker-0.1.8 lib/andrii_codebreaker/user.rb
andrii_codebreaker-0.1.7 lib/andrii_codebreaker/user.rb