Sha256: 8f66ff47dc6bd07046b594d79a737571f12ffc8253c4ee0e18d226b82083fd80

Contents?: true

Size: 619 Bytes

Versions: 8

Compression:

Stored size: 619 Bytes

Contents

module Compel
  module Validators

    class Base

      attr_reader :input,
                  :output,
                  :errors,
                  :schema

      def initialize(input, schema)
        @input = input.nil? ? schema.default_value : input
        @schema = schema
        @output = nil
        @errors = []
      end

      def valid?
        @errors.empty?
      end

      def self.validate(input, schema)
        new(input, schema).validate
      end

    end

  end
end

require 'compel/validators/type_validator'
require 'compel/validators/hash_validator'
require 'compel/validators/array_validator'

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
compel-0.5.1 lib/compel/validators/base.rb
compel-0.5.0 lib/compel/validators/base.rb
compel-0.4.3 lib/compel/validators/base.rb
compel-0.4.2 lib/compel/validators/base.rb
compel-0.4.0 lib/compel/validators/base.rb
compel-0.3.7 lib/compel/validators/base.rb
compel-0.3.6 lib/compel/validators/base.rb
compel-0.3.4 lib/compel/validators/base.rb