Class: BundlerMCP::ResourceCollection

Inherits:
Object
  • Object
show all
Includes:
Enumerable, Singleton
Defined in:
lib/bundler_mcp/resource_collection.rb

Overview

Represents a collection of GemResource objects defining all currently bundled gems

See Also:

Instance Method Summary collapse

Constructor Details

#initializeResourceCollection

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

Yields:

  • (GemResource)

    each GemResource object in the collection



26
27
28
# File 'lib/bundler_mcp/resource_collection.rb', line 26

def each(&)
  resources.each(&)
end