Class: JSON::StrictSchemaGenerator

Inherits:
Object
  • Object
show all
Defined in:
lib/json/strict_schema_generator.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(schema) ⇒ StrictSchemaGenerator

Returns a new instance of StrictSchemaGenerator.



10
11
12
# File 'lib/json/strict_schema_generator.rb', line 10

def initialize(schema)
  @schema = schema
end

Instance Attribute Details

#schemaObject (readonly)

Returns the value of attribute schema.



3
4
5
# File 'lib/json/strict_schema_generator.rb', line 3

def schema
  @schema
end

Class Method Details

.call(schema) ⇒ Object

beware that the provided object must have symbol keys and will be modified



6
7
8
# File 'lib/json/strict_schema_generator.rb', line 6

def self.call(schema)
  new(schema).strictify!
end

Instance Method Details

#strictify!Object



14
15
16
17
18
# File 'lib/json/strict_schema_generator.rb', line 14

def strictify!
  set_strict_attributes_for(schema)

  schema
end