Class: PDCMetadata::Rights

Inherits:
Object
  • Object
show all
Defined in:
app/models/pdc_metadata/rights.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(identifier:, uri:, name:) ⇒ Rights

Returns a new instance of Rights.



6
7
8
9
10
# File 'app/models/pdc_metadata/rights.rb', line 6

def initialize(identifier:, uri:, name:)
  @identifier = identifier
  @uri = uri
  @name = name
end

Instance Attribute Details

#identifierObject

Returns the value of attribute identifier.



5
6
7
# File 'app/models/pdc_metadata/rights.rb', line 5

def identifier
  @identifier
end

#nameObject

Returns the value of attribute name.



5
6
7
# File 'app/models/pdc_metadata/rights.rb', line 5

def name
  @name
end

#uriObject

Returns the value of attribute uri.



5
6
7
# File 'app/models/pdc_metadata/rights.rb', line 5

def uri
  @uri
end

Class Method Details

.allObject



16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'app/models/pdc_metadata/rights.rb', line 16

def self.all
  @all ||= [
    Rights.new(identifier: "MIT", uri: "https://mit-license.org/", name: "MIT License"),
    Rights.new(identifier: "GPLv3", uri: "https://www.gnu.org/licenses/gpl-3.0.en.html", name: "GNU General Public License"),
    Rights.new(identifier: "CC BY", uri: "https://creativecommons.org/licenses/by/4.0/", name: "Creative Commons Attribution 4.0 International"),
    Rights.new(identifier: "CC BY-SA", uri: "https://creativecommons.org/licenses/by-sa/4.0/", name: "Creative Commons Attribution-ShareAlike 4.0 International"),
    Rights.new(identifier: "CC BY-NC", uri: "https://creativecommons.org/licenses/by-nc/4.0/", name: "Creative Commons Attribution-NonCommercial 4.0 International"),
    Rights.new(identifier: "CC BY-NC-SA", uri: "https://creativecommons.org/licenses/by-nc-sa/4.0/", name: "Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International"),
    Rights.new(identifier: "CC BY-ND", uri: "https://creativecommons.org/licenses/by-nd/4.0/", name: "Creative Commons Attribution-NoDerivatives 4.0 International"),
    Rights.new(identifier: "CC BY-NC-ND", uri: "https://creativecommons.org/licenses/by-nc-nd/4.0/", name: "Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International"),
    Rights.new(identifier: "CC0", uri: "https://creativecommons.org/publicdomain/zero/1.0/", name: "Creative Commons 1.0 Universal - Public Domain Dedication")
  ]
end

.find(identifier) ⇒ Object



30
31
32
# File 'app/models/pdc_metadata/rights.rb', line 30

def self.find(identifier)
  all.find { |rights| rights.identifier == identifier }
end

Instance Method Details

#compare_valueObject



12
13
14
# File 'app/models/pdc_metadata/rights.rb', line 12

def compare_value
  @name
end