class Gemat::Gem

Attributes

github[RW]
index[RW]
rubygems[RW]

Public Class Methods

new(rubygems) click to toggle source
# File lib/gem.rb, line 7
def initialize(rubygems)
  @rubygems = rubygems
  @index = 0
end

Public Instance Methods

repo_uri() click to toggle source
# File lib/gem.rb, line 12
def repo_uri
  match = github_uri_match([@rubygems.dig('metadata', 'homepage_uri'),
                            @rubygems['homepage_uri'],
                            @rubygems['bug_tracker_uri'],
                            @rubygems['source_code_uri']])
  return if match.nil?

  user = match[1]
  repo = match[2]
  "https://github.com/#{user}/#{repo}"
end

Private Instance Methods

github_uri_match(uris) click to toggle source
# File lib/gem.rb, line 26
def github_uri_match(uris)
  reg = %r{github.com/([\w\-]+)/([\w\-]+)}
  uris.each do |uri|
    return reg.match(uri) if reg.match(uri)
  end
end