Sha256: 98b2c2bf9f1ef1d46fc81f83c9b72fbb76c0878ed6fe620595e419a1d59a539c
Contents?: true
Size: 641 Bytes
Versions: 12
Compression:
Stored size: 641 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) 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
12 entries across 12 versions & 1 rubygems