Sha256: aef468b1cc20530b61cc47cb1968930ca93da56dcb065970baee8333ba071c07

Contents?: true

Size: 665 Bytes

Versions: 27

Compression:

Stored size: 665 Bytes

Contents

# frozen_string_literal: true

module Dor
  class Ontology
    class << self
      def key?(key)
        @data.key?(key)
      end

      # Yields each term to the block provided
      def options
        @data.map do |k, _v|
          yield property(k)
        end
      end

      def property(key)
        Term.new(@data[key].merge(key: key))
      end
    end

    class Term
      def initialize(uri:, human_readable:, key:, deprecation_warning: nil)
        @label = human_readable
        @uri = uri
        @deprecation_warning = deprecation_warning
        @key = key
      end

      attr_reader :label, :uri, :deprecation_warning, :key
    end
  end
end

Version data entries

27 entries across 27 versions & 1 rubygems

Version Path
dor-services-9.6.2 lib/dor/services/ontology.rb
dor-services-9.6.1 lib/dor/services/ontology.rb
dor-services-9.6.0 lib/dor/services/ontology.rb
dor-services-9.5.0 lib/dor/services/ontology.rb
dor-services-9.4.0 lib/dor/services/ontology.rb
dor-services-9.3.0 lib/dor/services/ontology.rb
dor-services-9.2.1 lib/dor/services/ontology.rb
dor-services-9.2.0 lib/dor/services/ontology.rb
dor-services-9.1.0 lib/dor/services/ontology.rb
dor-services-9.0.0 lib/dor/services/ontology.rb
dor-services-8.6.0 lib/dor/services/ontology.rb
dor-services-8.5.0 lib/dor/services/ontology.rb
dor-services-8.4.0 lib/dor/services/ontology.rb
dor-services-8.3.0 lib/dor/services/ontology.rb
dor-services-8.2.0 lib/dor/services/ontology.rb
dor-services-8.1.1 lib/dor/services/ontology.rb
dor-services-8.1.0 lib/dor/services/ontology.rb
dor-services-8.0.0 lib/dor/services/ontology.rb
dor-services-7.2.4 lib/dor/services/ontology.rb
dor-services-7.2.3 lib/dor/services/ontology.rb