Module: Merritt::Manifest::Field::ClassMethods
- Included in:
- Merritt::Manifest::Fields::Object
- Defined in:
- lib/merritt/manifest/fields.rb
Overview
Class methods for field enumerations
Instance Method Summary collapse
-
#fields ⇒ String
A list of all fields.
-
#prefixes ⇒ Hash<Symbol, String>
Gets all prefixes in these fields, and their URLs.
-
#url_for(prefix) ⇒ String
Gets the string for the specified prefix.
Instance Method Details
#fields ⇒ String
A list of all fields
51 52 53 |
# File 'lib/merritt/manifest/fields.rb', line 51 def fields @fields ||= to_a.map(&:value).freeze end |
#prefixes ⇒ Hash<Symbol, String>
Gets all prefixes in these fields, and their URLs
42 43 44 45 46 47 |
# File 'lib/merritt/manifest/fields.rb', line 42 def prefixes @prefixes ||= begin all_prefixes = to_a.map(&:prefix).uniq.sort.freeze all_prefixes.map { |p| [p, url_for(p)] }.to_h.freeze end end |
#url_for(prefix) ⇒ String
Gets the string for the specified prefix
58 59 60 61 62 63 64 65 66 |
# File 'lib/merritt/manifest/fields.rb', line 58 def url_for(prefix) # noinspection RubyCaseWithoutElseBlockInspection case prefix.to_sym when :mrt 'http://merritt.cdlib.org/terms#' when :nfo 'http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#' end end |