Class: OasRage::RouteExtractor
- Inherits:
-
Object
- Object
- OasRage::RouteExtractor
- Defined in:
- lib/oas_rage/route_extractor.rb
Instance Method Summary collapse
-
#clear_cache ⇒ Object
Clear instance variable @host_routes.
- #host_paths ⇒ Object
- #host_routes ⇒ Object
- #host_routes_by_path(path) ⇒ Object
-
#initialize ⇒ RouteExtractor
constructor
A new instance of RouteExtractor.
Constructor Details
#initialize ⇒ RouteExtractor
Returns a new instance of RouteExtractor.
5 6 7 8 |
# File 'lib/oas_rage/route_extractor.rb', line 5 def initialize @host_routes = nil @host_paths = nil end |
Instance Method Details
#clear_cache ⇒ Object
Clear instance variable @host_routes
This method clears the instance variable @host_routes to force a re-extraction of the routes.
22 23 24 25 |
# File 'lib/oas_rage/route_extractor.rb', line 22 def clear_cache @host_routes = nil @host_paths = nil end |
#host_paths ⇒ Object
27 28 29 |
# File 'lib/oas_rage/route_extractor.rb', line 27 def host_paths @host_paths ||= host_routes.map(&:path).uniq.sort end |
#host_routes ⇒ Object
14 15 16 |
# File 'lib/oas_rage/route_extractor.rb', line 14 def host_routes @host_routes ||= extract_host_routes end |
#host_routes_by_path(path) ⇒ Object
10 11 12 |
# File 'lib/oas_rage/route_extractor.rb', line 10 def host_routes_by_path(path) host_routes.select { |r| r.path == path } end |