Class: RailsAiContext::Introspectors::ActiveSupportIntrospector

Inherits:
Object
  • Object
show all
Extended by:
StaticTier
Defined in:
lib/rails_ai_context/introspectors/active_support_introspector.rb

Overview

Extracts ActiveSupport runtime surface that other introspectors don't cover: Concerns registry (app/**/concerns), Deprecators registry, MessageEncryptor/MessageVerifier usage, and TaggedLogging tags. Covers RAILS_NERVOUS_SYSTEM.md ยง17 (ActiveSupport).

Constant Summary

Constants included from StaticTier

StaticTier::ALTERNATE_SOURCE, StaticTier::FILES_ONLY, StaticTier::KINDS, StaticTier::RUNTIME_ONLY

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from StaticTier

answers_statically?, static_tier, static_tier_declared?, unavailable_reason, validate_static_tier!

Constructor Details

#initialize(app) ⇒ ActiveSupportIntrospector

Returns a new instance of ActiveSupportIntrospector.



15
16
17
# File 'lib/rails_ai_context/introspectors/active_support_introspector.rb', line 15

def initialize(app)
  @app = app
end

Instance Attribute Details

#appObject (readonly)

Returns the value of attribute app.



13
14
15
# File 'lib/rails_ai_context/introspectors/active_support_introspector.rb', line 13

def app
  @app
end

Instance Method Details

#callObject



19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/rails_ai_context/introspectors/active_support_introspector.rb', line 19

def call
  {
    concerns: extract_concerns,
    deprecators: extract_deprecators,
    message_verifier_usage: extract_message_verifier_usage,
    tagged_logging: detect_tagged_logging,
    on_load_hooks: common_on_load_hooks,
    cache_usage: detect_cache_usage
  }
rescue => e
  $stderr.puts "[rails-ai-context] ActiveSupportIntrospector#call failed: #{e.message}" if ENV["DEBUG"]
  { error: e.message }
end

#static_callObject

Concerns, MessageVerifier usage and tagged logging are read off disk. The registered deprecators, the subscribed load hooks and the cache store only exist in a running process; an empty list for them renders as "this app has none", so they refuse instead.



37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/rails_ai_context/introspectors/active_support_introspector.rb', line 37

def static_call
  unavailable = { unavailable: StaticTier.unavailable_reason }
  {
    concerns: extract_concerns,
    deprecators: unavailable,
    message_verifier_usage: extract_message_verifier_usage,
    tagged_logging: detect_tagged_logging,
    on_load_hooks: unavailable,
    cache_usage: unavailable
  }
rescue => e
  $stderr.puts "[rails-ai-context] ActiveSupportIntrospector#static_call failed: #{e.message}" if ENV["DEBUG"]
  { error: e.message }
end