Module: JSONSkooma::Keywords::ValueSchemas::ArrayOfSchemas

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

Instance Method Summary collapse

Instance Method Details

#each_schema(&block) ⇒ Object



65
66
67
68
69
# File 'lib/json_skooma/keywords/value_schemas.rb', line 65

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

  json.each(&block)
end

#wrap_value(value) ⇒ Object



52
53
54
55
56
57
58
59
60
61
62
63
# File 'lib/json_skooma/keywords/value_schemas.rb', line 52

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

  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