Class: RailsAiContext::Introspectors::ConfigIntrospector
- Inherits:
-
Object
- Object
- RailsAiContext::Introspectors::ConfigIntrospector
- Defined in:
- lib/rails_ai_context/introspectors/config_introspector.rb
Overview
Extracts application configuration: cache store, session store, timezone, middleware stack, initializers, credentials status.
Instance Attribute Summary collapse
-
#app ⇒ Object
readonly
Returns the value of attribute app.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(app) ⇒ ConfigIntrospector
constructor
A new instance of ConfigIntrospector.
Constructor Details
#initialize(app) ⇒ ConfigIntrospector
Returns a new instance of ConfigIntrospector.
10 11 12 |
# File 'lib/rails_ai_context/introspectors/config_introspector.rb', line 10 def initialize(app) @app = app end |
Instance Attribute Details
#app ⇒ Object (readonly)
Returns the value of attribute app.
8 9 10 |
# File 'lib/rails_ai_context/introspectors/config_introspector.rb', line 8 def app @app end |
Instance Method Details
#call ⇒ Object
14 15 16 17 18 19 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/config_introspector.rb', line 14 def call result = { cache_store: detect_cache_store, session_store: detect_session_store, timezone: app.config.time_zone.to_s, queue_adapter: detect_queue_adapter, mailer: detect_mailer_settings, middleware_stack: extract_middleware, initializers: extract_initializers, credentials_configured: credentials_configured?, current_attributes: detect_current_attributes, error_monitoring: detect_error_monitoring, job_processor: detect_job_processor_config } # Extract cache store options when configured as an Array if app.config.cache_store.is_a?(Array) && app.config.cache_store.size > 1 opts = app.config.cache_store[1..] cache_opts = opts.last.is_a?(Hash) ? opts.last.keys.map(&:to_s) : [] result[:cache_store_options] = cache_opts if cache_opts.any? end result.compact rescue => e { error: e. } end |