Class: Woods::Extractors::MiddlewareExtractor
- Inherits:
-
Object
- Object
- Woods::Extractors::MiddlewareExtractor
- Defined in:
- lib/woods/extractors/middleware_extractor.rb
Overview
MiddlewareExtractor handles Rack middleware stack extraction via runtime introspection.
Reads the middleware stack from ‘Rails.application.middleware` and produces a single ExtractedUnit representing the full ordered stack. Each middleware entry includes the class name, arguments, and insertion point.
Instance Method Summary collapse
-
#extract_all ⇒ Array<ExtractedUnit>
Extract the middleware stack as a single ExtractedUnit.
-
#initialize ⇒ MiddlewareExtractor
constructor
A new instance of MiddlewareExtractor.
Constructor Details
#initialize ⇒ MiddlewareExtractor
Returns a new instance of MiddlewareExtractor.
17 18 19 |
# File 'lib/woods/extractors/middleware_extractor.rb', line 17 def initialize # No directories to scan — this is runtime introspection end |
Instance Method Details
#extract_all ⇒ Array<ExtractedUnit>
Extract the middleware stack as a single ExtractedUnit
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/woods/extractors/middleware_extractor.rb', line 24 def extract_all return [] unless middleware_available? stack = Rails.application.middleware entries = extract_middleware_entries(stack) return [] if entries.empty? unit = ExtractedUnit.new( type: :middleware, identifier: 'MiddlewareStack', file_path: nil ) unit.namespace = nil unit.source_code = build_stack_source(entries) unit. = (entries) unit.dependencies = [] [unit] rescue StandardError => e Rails.logger.error("Failed to extract middleware stack: #{e.}") [] end |