Module: Jschematic

Defined in:
lib/jschematic.rb,
lib/jschematic/errors.rb,
lib/jschematic/schema.rb,
lib/jschematic/context.rb,
lib/jschematic/element.rb,
lib/jschematic/version.rb,
lib/jschematic/composite.rb,
lib/jschematic/attributes.rb,
lib/jschematic/exceptions.rb,
lib/jschematic/attributes/ref.rb,
lib/jschematic/attributes/enum.rb,
lib/jschematic/attributes/type.rb,
lib/jschematic/attributes/items.rb,
lib/jschematic/attributes/format.rb,
lib/jschematic/attributes/extends.rb,
lib/jschematic/attributes/maximum.rb,
lib/jschematic/attributes/minimum.rb,
lib/jschematic/attributes/pattern.rb,
lib/jschematic/attributes/disallow.rb,
lib/jschematic/attributes/required.rb,
lib/jschematic/attributes/max_items.rb,
lib/jschematic/attributes/min_items.rb,
lib/jschematic/attributes/max_length.rb,
lib/jschematic/attributes/min_length.rb,
lib/jschematic/attributes/properties.rb,
lib/jschematic/attributes/dependencies.rb,
lib/jschematic/attributes/divisible_by.rb,
lib/jschematic/attributes/unique_items.rb,
lib/jschematic/attributes/additional_items.rb,
lib/jschematic/attributes/exclusive_maximum.rb,
lib/jschematic/attributes/exclusive_minimum.rb,
lib/jschematic/attributes/pattern_properties.rb,
lib/jschematic/attributes/additional_properties.rb

Defined Under Namespace

Modules: Attributes, Composite, Element Classes: Context, Errors, Schema, SchemaNotFoundError, ValidationError

Constant Summary collapse

VERSION =
"0.1.0"

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.debugObject

Returns the value of attribute debug.



16
17
18
# File 'lib/jschematic.rb', line 16

def debug
  @debug
end

Class Method Details

.validate(instance, schema, opts = {}) ⇒ Object



4
5
6
7
8
# File 'lib/jschematic.rb', line 4

def self.validate(instance, schema, opts={})
  validate!(instance, schema, opts)
rescue ValidationError
  false
end

.validate!(instance, schema, opts = {}) ⇒ Object



10
11
12
13
# File 'lib/jschematic.rb', line 10

def self.validate!(instance, schema, opts={})
  self.debug = opts[:debug]
  Context.new(*opts[:context]).validate!(instance, schema)
end