Sha256: 61e9d748c3cab0f3f7b2b7bd1473dc10e75625ceeed3092df426267a1a0012ff

Contents?: true

Size: 625 Bytes

Versions: 16

Compression:

Stored size: 625 Bytes

Contents

require "yaml"

class CompareLinker
  class GemDictionary
    attr_reader :file, :rubygems

    def initialize
      @file = File.join(__dir__, '../../data/rubygems.yml')
    end

    # Look gem info up from Dictionary
    #
    # @param gem_name [String]
    # @return [Array<String>] [repo_owner, repo_name]
    # @return [Array<NilClass>] cannot look up
    def lookup(gem_name)
      repo_full_name = rubygems[gem_name]

      if repo_full_name
        repo_full_name.split("/")
      else
        [nil, nil]
      end
    end

    private

    def rubygems
      @rubygems ||= YAML.load(IO.read(file))
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
compare_linker-1.4.6 lib/compare_linker/gem_dictionary.rb
compare_linker-1.4.5 lib/compare_linker/gem_dictionary.rb
compare_linker-1.4.4 lib/compare_linker/gem_dictionary.rb
compare_linker-1.4.3 lib/compare_linker/gem_dictionary.rb
compare_linker-1.4.2 lib/compare_linker/gem_dictionary.rb
compare_linker-1.4.1 lib/compare_linker/gem_dictionary.rb
compare_linker-1.4.0 lib/compare_linker/gem_dictionary.rb
compare_linker-1.3.8 lib/compare_linker/gem_dictionary.rb
compare_linker-1.3.7 lib/compare_linker/gem_dictionary.rb
compare_linker-1.3.6 lib/compare_linker/gem_dictionary.rb
compare_linker-1.3.5 lib/compare_linker/gem_dictionary.rb
compare_linker-1.3.4 lib/compare_linker/gem_dictionary.rb
compare_linker-1.3.3 lib/compare_linker/gem_dictionary.rb
compare_linker-1.3.2 lib/compare_linker/gem_dictionary.rb
compare_linker-1.3.1 lib/compare_linker/gem_dictionary.rb
compare_linker-1.3.0 lib/compare_linker/gem_dictionary.rb