Class: RailsAiContext::Introspectors::JobIntrospector
- Inherits:
-
Object
- Object
- RailsAiContext::Introspectors::JobIntrospector
- Extended by:
- StaticTier
- Defined in:
- lib/rails_ai_context/introspectors/job_introspector.rb
Overview
Discovers ActiveJob jobs, mailers, and Action Cable channels. Sidekiq reaches this only as config/sidekiq.yml: a class that includes Sidekiq::Worker without subclassing ActiveJob::Base is not a descendant and does not live in app/jobs/, so neither pass here finds it.
Constant Summary collapse
- CHANNEL_MACROS =
%i[identified_by stream_from stream_for periodically].freeze
Constants included from StaticTier
StaticTier::ALTERNATE_SOURCE, StaticTier::FILES_ONLY, StaticTier::KINDS, StaticTier::RUNTIME_ONLY
Instance Attribute Summary collapse
-
#app ⇒ Object
readonly
Returns the value of attribute app.
Instance Method Summary collapse
-
#call ⇒ Hash
Async workers, mailers, and channels.
-
#initialize(app) ⇒ JobIntrospector
constructor
A new instance of JobIntrospector.
-
#static_call ⇒ Object
Mailers and channels are ordinary classes in ordinary directories, so the answer is the same with or without a booted app.
Methods included from StaticTier
answers_statically?, static_tier, static_tier_declared?, unavailable_reason, validate_static_tier!
Constructor Details
#initialize(app) ⇒ JobIntrospector
Returns a new instance of JobIntrospector.
17 18 19 |
# File 'lib/rails_ai_context/introspectors/job_introspector.rb', line 17 def initialize(app) @app = app end |
Instance Attribute Details
#app ⇒ Object (readonly)
Returns the value of attribute app.
15 16 17 |
# File 'lib/rails_ai_context/introspectors/job_introspector.rb', line 15 def app @app end |
Instance Method Details
#call ⇒ Hash
Returns async workers, mailers, and channels.
22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/rails_ai_context/introspectors/job_introspector.rb', line 22 def call jobs = extract_jobs # Source parsing fallback when runtime reflection yields no results jobs = extract_jobs_from_source if jobs.empty? { jobs: jobs, mailers: extract_mailers, channels: extract_channels, recurring_jobs: extract_solid_queue_recurring, sidekiq_config: extract_sidekiq_config } end |
#static_call ⇒ Object
Mailers and channels are ordinary classes in ordinary directories, so the answer is the same with or without a booted app. Only the way in differs: descendants when Rails is up, the AST when it is not.
39 40 41 42 43 44 45 46 47 |
# File 'lib/rails_ai_context/introspectors/job_introspector.rb', line 39 def static_call { jobs: extract_jobs_from_source, mailers: extract_mailers_from_source, channels: extract_channels_from_source, recurring_jobs: extract_solid_queue_recurring, sidekiq_config: extract_sidekiq_config } end |