Class: RailsAiContext::Introspectors::ControllerIntrospector
- Inherits:
-
Object
- Object
- RailsAiContext::Introspectors::ControllerIntrospector
- Defined in:
- lib/rails_ai_context/introspectors/controller_introspector.rb
Overview
Discovers controllers and extracts filters, strong params, respond_to formats, concerns, actions, and API detection. Uses source-file parsing (not just Ruby reflection) so that changes made mid-session are always visible.
Instance Attribute Summary collapse
-
#app ⇒ Object
readonly
Returns the value of attribute app.
Instance Method Summary collapse
- #call ⇒ Object
- #excluded_filters ⇒ Object
-
#initialize(app) ⇒ ControllerIntrospector
constructor
A new instance of ControllerIntrospector.
Constructor Details
#initialize(app) ⇒ ControllerIntrospector
Returns a new instance of ControllerIntrospector.
16 17 18 |
# File 'lib/rails_ai_context/introspectors/controller_introspector.rb', line 16 def initialize(app) @app = app end |
Instance Attribute Details
#app ⇒ Object (readonly)
Returns the value of attribute app.
10 11 12 |
# File 'lib/rails_ai_context/introspectors/controller_introspector.rb', line 10 def app @app end |
Instance Method Details
#call ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/rails_ai_context/introspectors/controller_introspector.rb', line 20 def call eager_load_controllers! controllers = discover_controllers result = controllers.each_with_object({}) do |ctrl, hash| hash[ctrl.name] = extract_controller_details(ctrl) rescue => e hash[ctrl.name] = { error: e. } end # Discover controllers from filesystem that may not be loaded as classes discover_from_filesystem.each do |name, path| next if result.key?(name) result[name] = extract_details_from_source(path) end { controllers: result } rescue => e { error: e. } end |
#excluded_filters ⇒ Object
12 13 14 |
# File 'lib/rails_ai_context/introspectors/controller_introspector.rb', line 12 def excluded_filters RailsAiContext.configuration.excluded_filters end |