Module: Apipie::DSL::Concern
Instance Attribute Summary
Attributes included from Base
Instance Method Summary collapse
- #_apipie_concern_data ⇒ Object
-
#included(controller) ⇒ Object
the concern was included into a controller.
-
#method_added(method_name) ⇒ Object
create method api and redefine newly added method.
Methods included from Param
#_default_param_group_scope, #param, #param_group
Methods included from Action
#api, #def_param_group, #example, #resource_description, #see
Methods included from Common
#_apipie_define_validators, #api_versions, #desc, #error, #formats
Instance Method Details
#_apipie_concern_data ⇒ Object
330 331 332 |
# File 'lib/apipie/dsl_definition.rb', line 330 def _apipie_concern_data @_apipie_concern_data ||= [] end |
#included(controller) ⇒ Object
the concern was included into a controller
321 322 323 324 325 326 327 328 |
# File 'lib/apipie/dsl_definition.rb', line 321 def included(controller) super _apipie_concern_data.each do |method_name, _apipie_dsl_data| # remove method description if exists and create new one description = Apipie.define_method_description(controller, method_name, _apipie_dsl_data) controller._apipie_define_validators(description) end end |
#method_added(method_name) ⇒ Object
create method api and redefine newly added method
335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 |
# File 'lib/apipie/dsl_definition.rb', line 335 def method_added(method_name) #:doc: super if ! Apipie.active_dsl? || _apipie_dsl_data[:api_args].blank? _apipie_dsl_data_clear return end begin _apipie_concern_data << [method_name, _apipie_dsl_data.merge(:from_concern => true)] ensure _apipie_dsl_data_clear end end |