Class: Lurker::Json::List

Inherits:
Schema
  • Object
show all
Defined in:
lib/lurker/json/schema/list.rb

Constant Summary

Constants inherited from Schema

Schema::EXTENSIONS, Schema::REQUEST_PARAMETERS, Schema::RESPONSE_CODES, Schema::RESPONSE_PARAMETERS

Instance Attribute Summary

Attributes inherited from Schema

#parent_property, #parent_schema, #root_schema, #uri

Instance Method Summary collapse

Methods inherited from Schema

#documentation, #documentation_uri, #initialize, #method_missing, #reorder!, #root?, #to_hash, #to_json, #to_yaml

Methods included from Concerns::Validatable

#to_validation_schema, #validate

Constructor Details

This class inherits a constructor from Lurker::Json::Schema

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Lurker::Json::Schema

Instance Method Details

#merge!(schema) ⇒ Object



4
5
6
7
8
9
10
# File 'lib/lurker/json/schema/list.rb', line 4

def merge!(schema)
  if schema.is_a?(Array)
    schema.each { |payload| @schema[Json::ITEMS].merge!(payload) }
  else
    @schema[Json::ITEMS].merge!(schema)
  end
end

#replace!(property, schema) ⇒ Object



12
13
14
15
16
17
18
# File 'lib/lurker/json/schema/list.rb', line 12

def replace!(property, schema)
  if @schema[Json::ITEMS].is_a?(Lurker::Json::Attribute)
    @schema[Json::ITEMS] = schema
  else
    @schema[Json::ITEMS].replace!(property, schema)
  end
end