Class: RailsAiBridge::ViewFileAnalyzer
- Inherits:
-
Object
- Object
- RailsAiBridge::ViewFileAnalyzer
- Defined in:
- lib/rails_ai_bridge/view_file_analyzer.rb
Overview
Extracts edit-focused metadata from a single view file.
Class Method Summary collapse
-
.call(root:, relative_path:, app: nil) ⇒ Hash
Reads a single view file under
app/viewsand extracts editing hints.
Class Method Details
.call(root:, relative_path:, app: nil) ⇒ Hash
Reads a single view file under app/views and extracts editing hints.
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/rails_ai_bridge/view_file_analyzer.rb', line 15 def call(root:, relative_path:, app: nil) context = ViewContext.new(root:, app:) view_file = resolve_view_file(context, relative_path) relative = view_file.relative_path content = File.read(view_file.path) { path: relative, template_engine: File.extname(relative).delete('.'), partial: File.basename(relative).start_with?('_'), renders: extract_renders(content), turbo_frames: extract_turbo_frames(content), stimulus_controllers: extract_stimulus_controllers(content), stimulus_actions: extract_stimulus_actions(content), content: content } end |