Class: OasRails::Extractors::RouteExtractor
- Inherits:
-
Object
- Object
- OasRails::Extractors::RouteExtractor
- Defined in:
- lib/oas_rails/extractors/route_extractor.rb
Constant Summary collapse
- RAILS_DEFAULT_CONTROLLERS =
%w[ rails/info rails/mailers active_storage/blobs active_storage/disk active_storage/direct_uploads active_storage/representations rails/conductor/continuous_integration rails/conductor/multiple_databases rails/conductor/action_mailbox rails/conductor/action_text action_cable ].freeze
- RAILS_DEFAULT_PATHS =
%w[ /rails/action_mailbox/ ].freeze
Class Method Summary collapse
- .clean_route(route) ⇒ Object
-
.clear_cache ⇒ Object
Clear Class Instance Variable @host_routes.
- .host_paths ⇒ Object
- .host_routes ⇒ Object
- .host_routes_by_path(path) ⇒ Object
Class Method Details
.clean_route(route) ⇒ Object
44 45 46 |
# File 'lib/oas_rails/extractors/route_extractor.rb', line 44 def clean_route(route) route.gsub('(.:format)', '').gsub(/:\w+/) { |match| "{#{match[1..]}}" } end |
.clear_cache ⇒ Object
Clear Class Instance Variable @host_routes
This method clear the class instance variable @host_routes to force a extraction of the routes again.
36 37 38 |
# File 'lib/oas_rails/extractors/route_extractor.rb', line 36 def clear_cache @host_routes = nil end |
.host_paths ⇒ Object
40 41 42 |
# File 'lib/oas_rails/extractors/route_extractor.rb', line 40 def host_paths @host_paths ||= host_routes.map(&:path).uniq.sort end |
.host_routes ⇒ Object
28 29 30 |
# File 'lib/oas_rails/extractors/route_extractor.rb', line 28 def host_routes @host_routes ||= extract_host_routes end |
.host_routes_by_path(path) ⇒ Object
23 24 25 26 |
# File 'lib/oas_rails/extractors/route_extractor.rb', line 23 def host_routes_by_path(path) @host_routes ||= extract_host_routes @host_routes.select { |r| r.path == path } end |