Class: R2OAS::Routing::Adjustor
- Defined in:
- lib/r2-oas/routing/adjustor.rb
Constant Summary collapse
- VALID_KEYS =
%i[route name verb path reqs].freeze
Instance Method Summary collapse
-
#initialize(route_data) ⇒ Adjustor
constructor
A new instance of Adjustor.
- #routes_els ⇒ Object
Constructor Details
#initialize(route_data) ⇒ Adjustor
Returns a new instance of Adjustor.
11 12 13 14 15 16 17 18 19 |
# File 'lib/r2-oas/routing/adjustor.rb', line 11 def initialize(route_data) valid_route_data?(route_data) @route_data = route_data @route = route_data[:route] @path_comp = PathComponent.new(route_data[:path]) @request_comp = RequestComponent.new(route_data[:reqs], @route.engine?) @verb_comp = VerbComponent.new(route_data[:verb]) @verbs = @verb_comp.verbs end |
Instance Method Details
#routes_els ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/r2-oas/routing/adjustor.rb', line 21 def routes_els @verbs.each_with_object([]) do |verb, result| route_el = {} route_el[:path] = @path_comp.symbol_to_brace route_el[:data] = { verb: verb, path: @path_comp.symbol_to_brace, tag_name: @request_comp.to_tag_name, schema_name: @request_comp.to_schema_name, format_name: @request_comp.to_format_name, required_parameters: @path_comp.path_parameters_data } result.push route_el end end |