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)


33
34
35
36
37
# File 'lib/json_skooma/keywords/value_schemas.rb', line 33

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

  yield json
end

#wrap_value(value) ⇒ Object



21
22
23
24
25
26
27
28
29
30
31
# File 'lib/json_skooma/keywords/value_schemas.rb', line 21

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

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