Sha256: 9311764793af86477776880650daf0733a2d71d5153ade25d1eb52783f86da25
Contents?: true
Size: 674 Bytes
Versions: 5
Compression:
Stored size: 674 Bytes
Contents
require_relative 'entity' module JSON module SchemaBuilder class Array < Entity register :array attribute :additional_items attribute :min_items attribute :max_items attribute :unique_items def items(*args, &block) opts = args.extract_options! schema[:items] = args.first schema[:items] ||= items_entity(opts, &block).as_json end protected 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 end end end
Version data entries
5 entries across 5 versions & 1 rubygems