Class: RailsAiContext::Introspectors::ActiveStorageIntrospector

Inherits:
Object
  • Object
show all
Defined in:
lib/rails_ai_context/introspectors/active_storage_introspector.rb

Overview

Discovers Active Storage usage: attachments, storage service config, direct upload detection.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(app) ⇒ ActiveStorageIntrospector

Returns a new instance of ActiveStorageIntrospector.



10
11
12
# File 'lib/rails_ai_context/introspectors/active_storage_introspector.rb', line 10

def initialize(app)
  @app = app
end

Instance Attribute Details

#appObject (readonly)

Returns the value of attribute app.



8
9
10
# File 'lib/rails_ai_context/introspectors/active_storage_introspector.rb', line 8

def app
  @app
end

Instance Method Details

#callObject



14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/rails_ai_context/introspectors/active_storage_introspector.rb', line 14

def call
  {
    installed: defined?(ActiveStorage) ? true : false,
    attachments: extract_attachments,
    storage_services: extract_storage_services,
    direct_upload: detect_direct_upload,
    validations: extract_attachment_validations,
    variants: extract_variants
  }
rescue => e
  { error: e.message }
end