Class: Woods::Extractors::RouteExtractor
- Inherits:
-
Object
- Object
- Woods::Extractors::RouteExtractor
- Includes:
- SharedUtilityMethods
- Defined in:
- lib/woods/extractors/route_extractor.rb
Overview
RouteExtractor handles Rails route extraction via runtime introspection.
Unlike file-based extractors, RouteExtractor reads the live routing table from ‘Rails.application.routes.routes`. Each route becomes an ExtractedUnit with metadata about HTTP method, path, controller, and action.
Instance Method Summary collapse
-
#extract_all ⇒ Array<ExtractedUnit>
Extract all routes from the Rails routing table.
-
#initialize ⇒ RouteExtractor
constructor
A new instance of RouteExtractor.
Methods included from SharedUtilityMethods
#app_source?, #condition_label, #count_loc, #detect_entry_points, #extract_action_filter_actions, #extract_callback_conditions, #extract_class_methods, #extract_class_name, #extract_custom_errors, #extract_initialize_params, #extract_namespace, #extract_parent_class, #extract_public_methods, #resolve_source_location, #skip_file?
Constructor Details
#initialize ⇒ RouteExtractor
Returns a new instance of RouteExtractor.
23 24 25 |
# File 'lib/woods/extractors/route_extractor.rb', line 23 def initialize # No directories to scan — this is runtime introspection end |
Instance Method Details
#extract_all ⇒ Array<ExtractedUnit>
Extract all routes from the Rails routing table
30 31 32 33 34 35 |
# File 'lib/woods/extractors/route_extractor.rb', line 30 def extract_all return [] unless rails_routes_available? routes = Rails.application.routes.routes routes.filter_map { |route| extract_route(route) } end |