class ApipieDSL::ReturnDescription::ReturnObject

Public Class Methods

new(method_description, options, block) click to toggle source
# File lib/apipie_dsl/return_description.rb, line 9
def initialize(method_description, options, block)
  @method_description = method_description
  @scope = options[:scope]
  @param_group = { scope: @scope }
  @options = options
  @return_type = (@options.keys & %i[array_of one_of object_of param_group]).first
end

Public Instance Methods

default_param_group_scope() click to toggle source

this routine overrides Param#default_param_group_scope and is called if Param#param_group is invoked during the instance_exec call in ReturnObject#initialize

# File lib/apipie_dsl/return_description.rb, line 20
def default_param_group_scope
  @scope
end
docs(lang = nil) click to toggle source
# File lib/apipie_dsl/return_description.rb, line 35
def docs(lang = nil)
  {
    meta: @return_type,
    class: return_class,
    data: @options[@return_type]
  }
end
return_class() click to toggle source
# File lib/apipie_dsl/return_description.rb, line 24
def return_class
  case @return_type
  when :object_of
    @options[@return_type]
  when :one_of, :param_group
    Object
  when :array_of
    Array
  end
end