Class: RailsAiBridge::Introspectors::GemIntrospector
- Inherits:
-
Object
- Object
- RailsAiBridge::Introspectors::GemIntrospector
- Defined in:
- lib/rails_ai_bridge/introspectors/gem_introspector.rb
Overview
Analyzes Gemfile.lock to identify installed gems and map them to known patterns/frameworks the AI should know about.
Instance Attribute Summary collapse
-
#app ⇒ Object
readonly
Returns the value of attribute app.
Instance Method Summary collapse
-
#call ⇒ Hash
Parse
Gemfile.lockand classify notable gems. -
#initialize(app) ⇒ GemIntrospector
constructor
A new instance of GemIntrospector.
Constructor Details
#initialize(app) ⇒ GemIntrospector
Returns a new instance of GemIntrospector.
10 11 12 |
# File 'lib/rails_ai_bridge/introspectors/gem_introspector.rb', line 10 def initialize(app) @app = app end |
Instance Attribute Details
#app ⇒ Object (readonly)
Returns the value of attribute app.
8 9 10 |
# File 'lib/rails_ai_bridge/introspectors/gem_introspector.rb', line 8 def app @app end |
Instance Method Details
#call ⇒ Hash
Parse Gemfile.lock and classify notable gems.
Returns { error: message } for any rescued StandardError — including a
missing or unreadable lockfile, malformed content, or any other runtime
exception — so callers always receive a controlled hash rather than an
unhandled exception.
24 25 26 27 28 29 30 31 |
# File 'lib/rails_ai_bridge/introspectors/gem_introspector.rb', line 24 def call lock_path = gemfile_lock_path return { error: 'No Gemfile.lock found' } unless File.exist?(lock_path) gem_summary(parse_lockfile(lock_path)) rescue StandardError => error { error: "GemIntrospector failed: #{error.class}" } end |