Class: RailsAiBridge::Introspectors::ActiveStorageIntrospector

Inherits:
Object
  • Object
show all
Defined in:
lib/rails_ai_bridge/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.

Parameters:

  • app (Rails::Application)

    host Rails application



11
12
13
14
# File 'lib/rails_ai_bridge/introspectors/active_storage_introspector.rb', line 11

def initialize(app)
  @app = app
  @path_resolver = PathResolver.new(app)
end

Instance Attribute Details

#appObject (readonly)

Returns the value of attribute app.



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

def app
  @app
end

#path_resolverObject (readonly)

Returns the value of attribute path_resolver.



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

def path_resolver
  @path_resolver
end

Instance Method Details

#callHash

Builds a read-only summary of Active Storage usage.

Returns:

  • (Hash)

    Active Storage installation, attachment, service, and direct-upload metadata



19
20
21
22
23
24
25
26
27
28
# File 'lib/rails_ai_bridge/introspectors/active_storage_introspector.rb', line 19

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