class Apipie::Params::Descriptor::Array

Public Class Methods

build(argument, options, block) click to toggle source
# File lib/apipie/params/descriptor.rb, line 242
def self.build(argument, options, block)
  if argument == ::Array && block.is_a?(::Proc)
    self.new(block, options)
  end
end
new(descriptor_or_block, options) click to toggle source
Calls superclass method Apipie::Params::Descriptor::Base::new
# File lib/apipie/params/descriptor.rb, line 248
def initialize(descriptor_or_block, options)
  super(options)
  case descriptor_or_block
  when ::Proc
    @descriptor = Hash.new(descriptor_or_block, options)
  when Descriptor::Base
    @descriptor = descriptor_or_block
  else
    raise ArgumentError, "Proc or Descriptor::Base expected, got #{descriptor_or_block.class.name}"
  end
end

Public Instance Methods

description() click to toggle source
# File lib/apipie/params/descriptor.rb, line 260
def description
  "Must be an Array"
end
json_schema() click to toggle source
# File lib/apipie/params/descriptor.rb, line 264
def json_schema
  super.merge(
    'type' => 'array',
    'items' => @descriptor.json_schema
  )
end
method_missing(method, *args, &block) click to toggle source
Calls superclass method
# File lib/apipie/params/descriptor.rb, line 281
def method_missing(method, *args, &block)
  if respond_to?(method)
    @descriptor.send(method, *args, &block)
  else
    super
  end
end
respond_to?(method) click to toggle source

delegate to params and param only if @descriptor supports those

Calls superclass method
# File lib/apipie/params/descriptor.rb, line 272
def respond_to?(method)
  case method.to_s
  when 'params', 'param'
    @descriptor.respond_to?(method)
  else
    super
  end
end