Class: BundlerMCP::ResourceCollection
- Inherits:
-
Object
- Object
- BundlerMCP::ResourceCollection
- Includes:
- Enumerable, Singleton
- Defined in:
- lib/bundler_mcp/resource_collection.rb
Overview
Represents a collection of GemResource objects defining all currently bundled gems
Instance Method Summary collapse
-
#each {|GemResource| ... } ⇒ Object
Iterate over all GemResource objects in the collection.
-
#initialize ⇒ ResourceCollection
constructor
A new instance of ResourceCollection.
Constructor Details
#initialize ⇒ ResourceCollection
Returns a new instance of ResourceCollection.
13 14 15 16 17 18 19 20 21 22 |
# File 'lib/bundler_mcp/resource_collection.rb', line 13 def initialize @resources = [] Gem.loaded_specs.each_value do |spec| # Returns most gems as Bundler::StubSpecification, which does not expose # many gem details, so we convert to Gem::Specification spec = Gem::Specification.find_by_name(spec.name) resources << GemResource.new(spec) end end |
Instance Method Details
#each {|GemResource| ... } ⇒ Object
Iterate over all GemResource objects in the collection
26 27 28 |
# File 'lib/bundler_mcp/resource_collection.rb', line 26 def each(&) resources.each(&) end |