Sha256: 21a831c956ec28afd7554006eff21ba0ea2701fdbd52fb3e60bd792e35234973
Contents?: true
Size: 885 Bytes
Versions: 51
Compression:
Stored size: 885 Bytes
Contents
# frozen_string_literal: true module Cocina module Models class Vocabulary # @private # Disabled this cop because we want @@uri to be inheritable. # rubocop:disable Style/ClassVars def self.create(uri) @@uri = uri self end # rubocop:enable Style/ClassVars def self.to_s @@uri end def self.property(name, method_name: name.to_s.underscore.to_sym) uri = [to_s, name].join properties[name] = uri (class << self; self; end).send(:define_method, method_name) { uri } end def self.properties @properties ||= {} end ## # Returns the URI for the term `property` in this vocabulary. # # @param [#to_sym] property # @return [String] def self.[](property) properties[property.to_sym] end end end end
Version data entries
51 entries across 51 versions & 1 rubygems