Class: Gemat::Gem

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(rubygems) ⇒ Gem

Returns a new instance of Gem.



7
8
9
10
# File 'lib/gem.rb', line 7

def initialize(rubygems)
  @rubygems = rubygems
  @index = 0
end

Instance Attribute Details

#githubObject

Returns the value of attribute github.



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

def github
  @github
end

#indexObject

Returns the value of attribute index.



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

def index
  @index
end

#rubygemsObject

Returns the value of attribute rubygems.



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

def rubygems
  @rubygems
end

Instance Method Details

#repo_uriObject



12
13
14
15
16
17
18
19
20
21
22
# 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