Class: Gitlab::Git::DeclaredLicense

Inherits:
Object
  • Object
show all
Defined in:
lib/gitlab/git/declared_license.rb

Overview

DeclaredLicense is the software license declared in a LICENSE or COPYING file in the git repository.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(key: nil, name: nil, nickname: nil, url: nil, path: nil) ⇒ DeclaredLicense

Returns a new instance of DeclaredLicense.



23
24
25
26
27
28
29
# File 'lib/gitlab/git/declared_license.rb', line 23

def initialize(key: nil, name: nil, nickname: nil, url: nil, path: nil)
  @key = key
  @name = name
  @nickname = nickname
  @url = url
  @path = path
end

Instance Attribute Details

#keyObject (readonly)

SPDX Identifier for the license



9
10
11
# File 'lib/gitlab/git/declared_license.rb', line 9

def key
  @key
end

#nameObject (readonly)

Full name of the license



12
13
14
# File 'lib/gitlab/git/declared_license.rb', line 12

def name
  @name
end

#nicknameObject (readonly)

Nickname of the license (optional, a shorter user-friendly name)



15
16
17
# File 'lib/gitlab/git/declared_license.rb', line 15

def nickname
  @nickname
end

#pathObject

Filename of the file containing license



18
19
20
# File 'lib/gitlab/git/declared_license.rb', line 18

def path
  @path
end

#urlObject (readonly)

URL that points to the LICENSE



21
22
23
# File 'lib/gitlab/git/declared_license.rb', line 21

def url
  @url
end

Instance Method Details

#==(other) ⇒ Object



31
32
33
34
35
# File 'lib/gitlab/git/declared_license.rb', line 31

def ==(other)
  return unless other.is_a?(self.class)

  key == other.key
end