Module: Apipie::DSL::Concern
Instance Attribute Summary
Attributes included from Base
#api_params, #apipie_resource_descriptions
Instance Method Summary collapse
- #_apipie_concern_data ⇒ Object
- #_apipie_concern_update_api_blocks ⇒ Object
- #apipie_concern? ⇒ Boolean
-
#included(controller) ⇒ Object
the concern was included into a controller.
-
#method_added(method_name) ⇒ Object
create method api and redefine newly added method.
- #update_api(*methods, &block) ⇒ Object
Methods included from Param
#_default_param_group_scope, #param, #param_group, #property, #returns
Methods included from Action
#api, #api!, #def_param_group, #example, #resource_description, #see, #show
Methods included from Common
#_apipie_define_validators, #_apipie_get_method_params, #_apipie_handle_validate_key_error, #_apipie_save_method_params, #api_versions, #desc, #document, #error, #formats, #header, #meta, #tags
Methods included from Base
Instance Method Details
#_apipie_concern_data ⇒ Object
582 583 584 |
# File 'lib/apipie/dsl_definition.rb', line 582 def _apipie_concern_data @_apipie_concern_data ||= [] end |
#_apipie_concern_update_api_blocks ⇒ Object
586 587 588 |
# File 'lib/apipie/dsl_definition.rb', line 586 def _apipie_concern_update_api_blocks @_apipie_concern_update_api_blocks ||= [] end |
#apipie_concern? ⇒ Boolean
590 591 592 |
# File 'lib/apipie/dsl_definition.rb', line 590 def apipie_concern? true end |
#included(controller) ⇒ Object
the concern was included into a controller
570 571 572 573 574 575 576 577 578 579 580 |
# File 'lib/apipie/dsl_definition.rb', line 570 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 _apipie_concern_update_api_blocks.each do |(methods, block)| controller.apipie_update_methods(methods, &block) end end |
#method_added(method_name) ⇒ Object
create method api and redefine newly added method
595 596 597 598 599 600 601 602 603 |
# File 'lib/apipie/dsl_definition.rb', line 595 def method_added(method_name) #:doc: super return if ! Apipie.active_dsl? || !_apipie_dsl_data[:api] _apipie_concern_data << [method_name, _apipie_dsl_data.merge(:from_concern => true)] ensure _apipie_dsl_data_clear end |
#update_api(*methods, &block) ⇒ Object
605 606 607 |
# File 'lib/apipie/dsl_definition.rb', line 605 def update_api(*methods, &block) _apipie_concern_update_api_blocks << [methods, block] end |