Sha256: 6a7708c5bd819d655976be89ebba0f0e5d4be5e5b81506f33c54ce2a50542771
Contents?: true
Size: 470 Bytes
Versions: 1
Compression:
Stored size: 470 Bytes
Contents
# frozen_string_literal: true module Codebreaker class Player include Validation attr_reader :errors attr_accessor :name def valid? validate errors.empty? end private def validate @errors = [] errors << 'Name cannot be blank' if name.empty? errors << 'Should be between 3-20 chars' unless size_correct?(name) errors << 'Should consists of letters' unless class_valid?(name, String) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
codebreaker-Bulatkin-0.1.0 | lib/codebreaker/player.rb |