class Schemacop::Schema2
Public Class Methods
new(*args, **kwargs, &block)
click to toggle source
Calls superclass method
# File lib/schemacop/schema2.rb, line 3 def initialize(*args, **kwargs, &block) super() @root = V2::HashValidator.new do req :root, *args, **kwargs, &block end end
Public Instance Methods
validate(data)
click to toggle source
Validate data for the defined Schema
@param data The data to validate. @return [Schemacop::Collector] The object that collected errors
throughout the validation.
# File lib/schemacop/schema2.rb, line 15 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