Module: JSONSkooma::Keywords::ValueSchemas::Schema

Defined in:
lib/json_skooma/keywords/value_schemas.rb

Instance Method Summary collapse

Instance Method Details

#each_schema {|json| ... } ⇒ Object

Yields:

  • (json)


43
44
45
46
47
# File 'lib/json_skooma/keywords/value_schemas.rb', line 43

def each_schema
  return super unless json.is_a?(JSONSchema)

  yield json
end

#wrap_value(value) ⇒ Object



31
32
33
34
35
36
37
38
39
40
41
# File 'lib/json_skooma/keywords/value_schemas.rb', line 31

def wrap_value(value)
  return super unless value.is_a?(Hash) || value.is_a?(TrueClass) || value.is_a?(FalseClass)

  (self.class.schema_value_class || ValueSchemas.default_schema_class).new(
    value,
    parent: parent_schema,
    key: key,
    registry: parent_schema.registry,
    cache_id: parent_schema.cache_id
  )
end