Class: CompareLinker::GithubTagFinder

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(octokit) ⇒ GithubTagFinder

Returns a new instance of GithubTagFinder.



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

def initialize(octokit)
  @octokit = octokit
end

Instance Attribute Details

#octokitObject (readonly)

Returns the value of attribute octokit.



3
4
5
# File 'lib/compare_linker/github_tag_finder.rb', line 3

def octokit
  @octokit
end

Instance Method Details

#find(repo_full_name, gem_version) ⇒ Object



9
10
11
12
13
14
15
16
# File 'lib/compare_linker/github_tag_finder.rb', line 9

def find(repo_full_name, gem_version)
  tags = octokit.tags(repo_full_name)
  if tags
    tags.find { |tag|
      tag.name == gem_version || tag.name == "v#{gem_version}"
    }
  end
end