Class: RailsAiBridge::Introspectors::ViewIntrospector

Inherits:
Object
  • Object
show all
Defined in:
lib/rails_ai_bridge/introspectors/view_introspector.rb

Overview

Scans view layer: layouts, templates, partials, helpers, view components, and template engine detection.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(app) ⇒ ViewIntrospector

Initializes the view introspector and path resolver.

Parameters:

  • app (Rails::Application)

    host Rails application



84
85
86
87
# File 'lib/rails_ai_bridge/introspectors/view_introspector.rb', line 84

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/view_introspector.rb', line 8

def app
  @app
end

Instance Method Details

#callHash

Builds a read-only summary of layouts, templates, partials, helpers, components, and template engines discovered through configured Rails paths.

Returns:

  • (Hash)

    view-layer metadata, or an +:error+ key when detection fails



94
95
96
97
98
99
100
101
102
103
104
105
# File 'lib/rails_ai_bridge/introspectors/view_introspector.rb', line 94

def call
  {
    layouts: extract_layouts,
    templates: extract_templates,
    partials: extract_partials,
    helpers: extract_helpers,
    view_components: extract_view_components,
    template_engines: detect_template_engines
  }
rescue StandardError => error
  { error: error.message }
end