Class: Apipie::DSL::ResourceDescriptionDsl

Inherits:
Object
  • Object
show all
Includes:
Base, Common, Param, Resource
Defined in:
lib/apipie/dsl_definition.rb

Instance Attribute Summary

Attributes included from Base

#apipie_resource_descriptions

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Param

#_default_param_group_scope, #param, #param_group

Methods included from Resource

#api_base_url, #app_info, #name, #path, #resource_id, #short

Methods included from Common

#_apipie_define_validators, #api_versions, #desc, #error, #formats

Constructor Details

#initialize(controller) ⇒ ResourceDescriptionDsl

Returns a new instance of ResourceDescriptionDsl.



359
360
361
# File 'lib/apipie/dsl_definition.rb', line 359

def initialize(controller)
  @controller = controller
end

Class Method Details

.eval_dsl(controller, &block) ⇒ Object

evaluates resource description DSL and returns results



369
370
371
372
373
374
375
# File 'lib/apipie/dsl_definition.rb', line 369

def self.eval_dsl(controller, &block)
  dsl_data  = self.new(controller)._eval_dsl(&block)
  if dsl_data[:api_versions].empty?
    dsl_data[:api_versions] = Apipie.controller_versions(controller)
  end
  dsl_data
end

Instance Method Details

#_eval_dsl(&block) ⇒ Object



363
364
365
366
# File 'lib/apipie/dsl_definition.rb', line 363

def _eval_dsl(&block)
  instance_eval(&block)
  return _apipie_dsl_data
end