Class: RailsAutodoc::RouteOperation
- Inherits:
-
Object
- Object
- RailsAutodoc::RouteOperation
- Defined in:
- lib/rails_autodoc/route_inspector.rb
Instance Attribute Summary collapse
-
#action ⇒ Object
readonly
Returns the value of attribute action.
-
#constraints ⇒ Object
readonly
Returns the value of attribute constraints.
-
#controller_class ⇒ Object
readonly
Returns the value of attribute controller_class.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
-
#path_params ⇒ Object
readonly
Returns the value of attribute path_params.
-
#route_name ⇒ Object
readonly
Returns the value of attribute route_name.
-
#tags ⇒ Object
readonly
Returns the value of attribute tags.
-
#verb ⇒ Object
readonly
Returns the value of attribute verb.
Instance Method Summary collapse
-
#initialize(verb:, path:, controller_class:, action:, route_name:, path_params:, tags:, constraints: {}) ⇒ RouteOperation
constructor
A new instance of RouteOperation.
- #openapi_path ⇒ Object
- #operation_id ⇒ Object
Constructor Details
#initialize(verb:, path:, controller_class:, action:, route_name:, path_params:, tags:, constraints: {}) ⇒ RouteOperation
Returns a new instance of RouteOperation.
14 15 16 17 18 19 20 21 22 23 |
# File 'lib/rails_autodoc/route_inspector.rb', line 14 def initialize(verb:, path:, controller_class:, action:, route_name:, path_params:, tags:, constraints: {}) @verb = verb @path = path @controller_class = controller_class @action = action.to_s @route_name = route_name @path_params = path_params @tags = @constraints = constraints end |
Instance Attribute Details
#action ⇒ Object (readonly)
Returns the value of attribute action.
5 6 7 |
# File 'lib/rails_autodoc/route_inspector.rb', line 5 def action @action end |
#constraints ⇒ Object (readonly)
Returns the value of attribute constraints.
5 6 7 |
# File 'lib/rails_autodoc/route_inspector.rb', line 5 def constraints @constraints end |
#controller_class ⇒ Object (readonly)
Returns the value of attribute controller_class.
5 6 7 |
# File 'lib/rails_autodoc/route_inspector.rb', line 5 def controller_class @controller_class end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
5 6 7 |
# File 'lib/rails_autodoc/route_inspector.rb', line 5 def path @path end |
#path_params ⇒ Object (readonly)
Returns the value of attribute path_params.
5 6 7 |
# File 'lib/rails_autodoc/route_inspector.rb', line 5 def path_params @path_params end |
#route_name ⇒ Object (readonly)
Returns the value of attribute route_name.
5 6 7 |
# File 'lib/rails_autodoc/route_inspector.rb', line 5 def route_name @route_name end |
#tags ⇒ Object (readonly)
Returns the value of attribute tags.
5 6 7 |
# File 'lib/rails_autodoc/route_inspector.rb', line 5 def @tags end |
#verb ⇒ Object (readonly)
Returns the value of attribute verb.
5 6 7 |
# File 'lib/rails_autodoc/route_inspector.rb', line 5 def verb @verb end |
Instance Method Details
#openapi_path ⇒ Object
29 30 31 |
# File 'lib/rails_autodoc/route_inspector.rb', line 29 def openapi_path path.gsub(/:([a-zA-Z_][a-zA-Z0-9_]*)/, '{\1}') end |
#operation_id ⇒ Object
25 26 27 |
# File 'lib/rails_autodoc/route_inspector.rb', line 25 def operation_id "#{controller_class.name.underscore.tr('/', '_')}_#{action}" end |