class JSON::SchemaBuilder::Array

Public Instance Methods

items(*args, &block) click to toggle source
# File lib/json/schema_builder/array.rb, line 12
def items(*args, &block)
  opts = args.extract_options!
  schema[:items] = args.first
  schema[:items] ||= items_entity(opts, &block).as_json
  parent.reinitialize if parent
end

Protected Instance Methods

items_entity(opts, &block) click to toggle source
# File lib/json/schema_builder/array.rb, line 21
def items_entity(opts, &block)
  opts[:parent] = self
  if opts[:type]
    send opts.delete(:type), opts, &block
  else
    Entity.new(nil, opts, &block).tap &:merge_children!
  end
end