Class: CompareLinker::GemDictionary

Inherits:
Object
  • Object
show all
Defined in:
lib/compare_linker/gem_dictionary.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeGemDictionary

Returns a new instance of GemDictionary.



7
8
9
# File 'lib/compare_linker/gem_dictionary.rb', line 7

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

Instance Attribute Details

#fileObject (readonly)

Returns the value of attribute file.



5
6
7
# File 'lib/compare_linker/gem_dictionary.rb', line 5

def file
  @file
end

Instance Method Details

#lookup(gem_name) ⇒ Array<String>, Array<NilClass>

Look gem info up from Dictionary

Parameters:

  • gem_name (String)

Returns:

  • (Array<String>)
    repo_owner, repo_name
  • (Array<NilClass>)

    cannot look up



16
17
18
19
20
21
22
23
24
# File 'lib/compare_linker/gem_dictionary.rb', line 16

def lookup(gem_name)
  repo_full_name = rubygems[gem_name]

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