Class: Schemacop::Schema3

Inherits:
BaseSchema show all
Defined in:
lib/schemacop/schema3.rb

Instance Attribute Summary

Attributes inherited from BaseSchema

#root

Instance Method Summary collapse

Methods inherited from BaseSchema

#invalid?, #valid?, #validate!

Constructor Details

#initialize(*args, **kwargs, &block) ⇒ Schema3

Returns a new instance of Schema3.



3
4
5
6
# File 'lib/schemacop/schema3.rb', line 3

def initialize(*args, **kwargs, &block)
  super()
  @root = V3::Node.create(*args, **kwargs, &block)
end

Instance Method Details

#as_jsonObject



17
18
19
# File 'lib/schemacop/schema3.rb', line 17

def as_json
  root.as_json
end

#validate(data) ⇒ Schemacop::Collector

Validate data for the defined Schema

Parameters:

  • data

    The data to validate.

Returns:

  • (Schemacop::Collector)

    The object that collected errors throughout the validation.



13
14
15
# File 'lib/schemacop/schema3.rb', line 13

def validate(data)
  root.validate(data)
end