Class: Dor::Ontology

Inherits:
Object
  • Object
show all
Extended by:
Deprecation
Defined in:
lib/dor/services/ontology.rb

Defined Under Namespace

Classes: Term

Class Method Summary collapse

Class Method Details

.[](key) ⇒ Object



9
10
11
12
# File 'lib/dor/services/ontology.rb', line 9

def [](key)
  Deprecation.warn(self, "#{self}.[] is deprecated and will be removed in #{Dor::Ontology.deprecation_horizon}. Use `property' instead.")
  @data[key]
end

.include?(key) ⇒ Boolean

Returns:

  • (Boolean)


18
19
20
21
# File 'lib/dor/services/ontology.rb', line 18

def include?(key)
  Deprecation.warn(self, "#{self}.include? is deprecated and will be removed in #{Dor::Ontology.deprecation_horizon}. Use `key?' instead.")
  @data.include?(key)
end

.key?(key) ⇒ Boolean

Returns:

  • (Boolean)


14
15
16
# File 'lib/dor/services/ontology.rb', line 14

def key?(key)
  @data.key?(key)
end

.map(&block) ⇒ Object



23
24
25
26
# File 'lib/dor/services/ontology.rb', line 23

def map(&block)
  Deprecation.warn(self, "#{self}.map is deprecated and will be removed in #{Dor::Ontology.deprecation_horizon}. Use `options' instead.")
  @data.map(&block)
end

.optionsObject

Yields each term to the block provided



29
30
31
32
33
# File 'lib/dor/services/ontology.rb', line 29

def options
  @data.map do |k, _v|
    yield property(k)
  end
end

.property(key) ⇒ Object



35
36
37
# File 'lib/dor/services/ontology.rb', line 35

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