Class: GemContribute::Project

Inherits:
Data
  • Object
show all
Defined in:
lib/gem_contribute/project.rb

Overview

A gem resolved to a host repository.

‘host` is one of: “github.com”, “gitlab.com”, “codeberg.org”, or :unknown. When :unknown, owner/repo are nil and `metadata` may carry whatever URI we found so the user can at least see it.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#gem_nameObject (readonly)

Returns the value of attribute gem_name

Returns:

  • (Object)

    the current value of gem_name



9
10
11
# File 'lib/gem_contribute/project.rb', line 9

def gem_name
  @gem_name
end

#hostObject (readonly)

Returns the value of attribute host

Returns:

  • (Object)

    the current value of host



9
10
11
# File 'lib/gem_contribute/project.rb', line 9

def host
  @host
end

#metadataObject (readonly)

Returns the value of attribute metadata

Returns:

  • (Object)

    the current value of metadata



9
10
11
# File 'lib/gem_contribute/project.rb', line 9

def 
  @metadata
end

#ownerObject (readonly)

Returns the value of attribute owner

Returns:

  • (Object)

    the current value of owner



9
10
11
# File 'lib/gem_contribute/project.rb', line 9

def owner
  @owner
end

#repoObject (readonly)

Returns the value of attribute repo

Returns:

  • (Object)

    the current value of repo



9
10
11
# File 'lib/gem_contribute/project.rb', line 9

def repo
  @repo
end

Instance Method Details

#known_host?Boolean

Returns:

  • (Boolean)


10
11
12
# File 'lib/gem_contribute/project.rb', line 10

def known_host?
  host.is_a?(String)
end

#urlObject



14
15
16
17
18
19
# File 'lib/gem_contribute/project.rb', line 14

def url
  return [:source_url] if  && !known_host?
  return nil unless owner && repo

  "https://#{host}/#{owner}/#{repo}"
end