module Merritt::Manifest::Field::ClassMethods
Class methods for field enumerations
Public Instance Methods
fields()
click to toggle source
A list of all fields @return [String] a list of all fields, as (prefix-qualified) names
# File lib/merritt/manifest/fields.rb, line 52 def fields @fields ||= to_a.map(&:value).freeze end
prefixes()
click to toggle source
Gets all prefixes in these fields, and their URLs @return [Hash<Symbol, String>] all prefixes used by these fields, as a map from symbol to URL string
# File lib/merritt/manifest/fields.rb, line 43 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)
click to toggle source
Gets the string for the specified prefix @param prefix [String, Symbol] the prefix @return [String] the URL string for the prefix
# File lib/merritt/manifest/fields.rb, line 59 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