Module: JSONSkooma::Keywords::ValueSchemas::ObjectOfSchemas

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

Instance Method Summary collapse

Instance Method Details

#each_schema(&block) ⇒ Object



88
89
90
91
92
# File 'lib/json_skooma/keywords/value_schemas.rb', line 88

def each_schema(&block)
  return super unless json.type == "object"

  json.each_value(&block)
end

#wrap_value(value) ⇒ Object



75
76
77
78
79
80
81
82
83
84
85
86
# File 'lib/json_skooma/keywords/value_schemas.rb', line 75

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

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