Sha256: a1fbbf01072f3237a68babeade1ee41a109be3b47995f41616623cb86b1bf6f5

Contents?: true

Size: 721 Bytes

Versions: 6

Compression:

Stored size: 721 Bytes

Contents

module Lotus
  module Validations
    # Validate given validations and return a set of errors
    #
    # @since 0.2.2
    # @api private
    class Validator
      def initialize(validation_set, attributes, errors)
        @validation_set = validation_set
        @attributes = attributes
        @errors = errors
      end

      # @since 0.2.2
      # @api private
      def validate
        @errors.clear
        @validation_set.each do |name, validations|
          value = @attributes[name]
          value = @attributes[name.to_s] if value.nil?

          attribute = Attribute.new(@attributes, name, value, validations, @errors)
          attribute.validate
        end
        @errors
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
lotus-validations-0.4.0 lib/lotus/validations/validator.rb
lotus-validations-0.3.3 lib/lotus/validations/validator.rb
lotus-validations-0.3.2 lib/lotus/validations/validator.rb
lotus-validations-0.3.1 lib/lotus/validations/validator.rb
lotus-validations-0.3.0 lib/lotus/validations/validator.rb
lotus-validations-0.2.4 lib/lotus/validations/validator.rb