Sha256: 5097ade886ff37270c9b60170909ebba2209cd47d7c5bda97511ea6b2a34281b

Contents?: true

Size: 940 Bytes

Versions: 18

Compression:

Stored size: 940 Bytes

Contents

# frozen_string_literal: true

require 'rubygems'
require 'eac_ruby_utils/gems_registry/gem'

module EacRubyUtils
  # Search in each gem for a class determined by registry and run the method "register" on each
  # found.
  #
  # Example:
  # * The module suffix is `TheClass`;
  # * A gem with name "my-lib" is being analyzed
  # * If a require for "my/lib/the_class" is succesful the class/module `My::Lib::TheClass` will
  #   be collected.
  class GemsRegistry
    attr_reader :module_suffix

    def initialize(module_suffix)
      @module_suffix = module_suffix
    end

    # @return [Array<EacRubyUtils::GemsRegistry::Gem>]
    def registered
      @registered ||= all_gems.select(&:found?)
    end

    private

    # @return [Array<EacRubyUtils::GemsRegistry::Gem>]
    def all_gems
      ::Gem::Specification.map { |gemspec| ::EacRubyUtils::GemsRegistry::Gem.new(self, gemspec) }
                          .sort
    end
  end
end

Version data entries

18 entries across 18 versions & 3 rubygems

Version Path
eac_ruby_utils-0.77.0 lib/eac_ruby_utils/gems_registry.rb
avm-tools-0.109.0 vendor/eac_ruby_utils/lib/eac_ruby_utils/gems_registry.rb
ehbrs-tools-0.28.2 vendor/eac_ruby_utils/lib/eac_ruby_utils/gems_registry.rb
avm-tools-0.108.0 vendor/eac_ruby_utils/lib/eac_ruby_utils/gems_registry.rb
ehbrs-tools-0.28.1 vendor/eac_ruby_utils/lib/eac_ruby_utils/gems_registry.rb
avm-tools-0.107.0 vendor/eac_ruby_utils/lib/eac_ruby_utils/gems_registry.rb
eac_ruby_utils-0.76.0 lib/eac_ruby_utils/gems_registry.rb
ehbrs-tools-0.28.0 vendor/eac_ruby_utils/lib/eac_ruby_utils/gems_registry.rb
avm-tools-0.106.0 vendor/eac_ruby_utils/lib/eac_ruby_utils/gems_registry.rb
ehbrs-tools-0.27.0 vendor/eac_ruby_utils/lib/eac_ruby_utils/gems_registry.rb
eac_ruby_utils-0.75.0 lib/eac_ruby_utils/gems_registry.rb
ehbrs-tools-0.26.0 vendor/eac_ruby_utils/lib/eac_ruby_utils/gems_registry.rb
avm-tools-0.105.0 vendor/eac_ruby_utils/lib/eac_ruby_utils/gems_registry.rb
ehbrs-tools-0.25.1 vendor/eac_ruby_utils/lib/eac_ruby_utils/gems_registry.rb
ehbrs-tools-0.25.0 vendor/eac_ruby_utils/lib/eac_ruby_utils/gems_registry.rb
eac_ruby_utils-0.74.0 lib/eac_ruby_utils/gems_registry.rb
eac_ruby_utils-0.73.0 lib/eac_ruby_utils/gems_registry.rb
eac_ruby_utils-0.72.1 lib/eac_ruby_utils/gems_registry.rb