Sha256: ae1540753793f6e7fd5cafbba23fb60dabe5bffc3d82fc76c65525f27de5e4e4

Contents?: true

Size: 416 Bytes

Versions: 2

Compression:

Stored size: 416 Bytes

Contents

# frozen_string_literal: true

module CodebrekerManfly
  class ValidatableEntity
    include Validator

    attr_reader :errors

    def initialize
      @errors = {}
    end

    def valid?
      validate
      errors.empty?
    end

    private

    def validate; end

    def add_error(attribute, error)
      @errors[attribute] = @errors[attribute].nil? ? [error] : @errors[attribute] << error
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
codebreker_manfly-0.1.2 lib/codebreker_manfly/entities/validatable_entity.rb
codebreker_manfly-0.1.1 lib/codebreker_manfly/entities/validatable_entity.rb