Class: Ddr::RightsStatement
- Inherits:
-
Struct
- Object
- Struct
- Ddr::RightsStatement
- Defined in:
- app/models/ddr/rights_statement.rb
Instance Attribute Summary collapse
-
#feature ⇒ Object
Returns the value of attribute feature.
-
#reuse_text ⇒ Object
Returns the value of attribute reuse_text.
-
#short_title ⇒ Object
Returns the value of attribute short_title.
-
#title ⇒ Object
Returns the value of attribute title.
-
#url ⇒ Object
Returns the value of attribute url.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#feature ⇒ Object
Returns the value of attribute feature
2 3 4 |
# File 'app/models/ddr/rights_statement.rb', line 2 def feature @feature end |
#reuse_text ⇒ Object
Returns the value of attribute reuse_text
2 3 4 |
# File 'app/models/ddr/rights_statement.rb', line 2 def reuse_text @reuse_text end |
#short_title ⇒ Object
Returns the value of attribute short_title
2 3 4 |
# File 'app/models/ddr/rights_statement.rb', line 2 def short_title @short_title end |
#title ⇒ Object
Returns the value of attribute title
2 3 4 |
# File 'app/models/ddr/rights_statement.rb', line 2 def title @title end |
#url ⇒ Object
Returns the value of attribute url
2 3 4 |
# File 'app/models/ddr/rights_statement.rb', line 2 def url @url end |
Class Method Details
.all ⇒ Object
12 13 14 |
# File 'app/models/ddr/rights_statement.rb', line 12 def self.all keystore.values end |
.call(obj) ⇒ Object
16 17 18 19 20 21 22 23 |
# File 'app/models/ddr/rights_statement.rb', line 16 def self.call(obj) return if obj.rights.empty? keystore.fetch(obj.rights.first) rescue KeyError => _ raise Ddr::NotFoundError, "Rights statement '#{obj.rights.first}' not found." end |
.config ⇒ Object
4 5 6 |
# File 'app/models/ddr/rights_statement.rb', line 4 def self.config @config ||= YAML.load_file(::File.('../../../config/aux/rights_statement.yml', __dir__)) end |
.keys ⇒ Object
25 26 27 |
# File 'app/models/ddr/rights_statement.rb', line 25 def self.keys keystore.keys end |
.keystore ⇒ Object
8 9 10 |
# File 'app/models/ddr/rights_statement.rb', line 8 def self.keystore @keystore ||= Hash[config.map { |entry| [entry['url'], new(entry).freeze] }].freeze end |
Instance Method Details
#to_s ⇒ Object
29 30 31 |
# File 'app/models/ddr/rights_statement.rb', line 29 def to_s title end |