Sha256: 216d58fc6f700f87d72ab1be2ade2966a40d97427cc405e159eb49deaf51aec7

Contents?: true

Size: 619 Bytes

Versions: 1

Compression:

Stored size: 619 Bytes

Contents

module Schemacop
  class Schema2 < BaseSchema
    def initialize(*args, &block)
      super()
      @root = V2::HashValidator.new do
        req :root, *args, &block
      end
    end

    # Validate data for the defined Schema
    #
    # @param data The data to validate.
    # @return [Schemacop::Collector] The object that collected errors
    #   throughout the validation.
    def validate(data)
      dupped_data = V2::Dupper.dup_data(data)
      collector = V2::Collector.new(dupped_data)
      root.fields[:root].validate({ root: data }, collector.ignore_next_segment)
      return collector
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
schemacop-3.0.0.rc0 lib/schemacop/schema2.rb