Sha256: e93a2514303d2751128a094aab22ccdd19d548dbf6ef1b2632b49cc9c9d5e05d

Contents?: true

Size: 465 Bytes

Versions: 1

Compression:

Stored size: 465 Bytes

Contents

# frozen_string_literal: true

module Truemail
  module Validate
    class Base
      attr_reader :result

      def self.check(result)
        new(result).run
      end

      def initialize(result)
        @result = result
      end

      private

      def success(condition)
        result.success = condition
      end

      def add_error(message)
        result.errors[self.class.name.split('::').last.downcase.to_sym] = message
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
truemail-0.1.1.3 lib/truemail/validate/base.rb