Class: Dbd::ProvenanceResource

Inherits:
Resource
  • Object
show all
Defined in:
lib/dbd/provenance_resource.rb

Overview

A ProvenanceResource is derived from a Resource, specifically for a Provenance (does not have and does need a provenance_subject)

Instance Attribute Summary

Attributes inherited from Resource

#subject

Instance Method Summary collapse

Methods inherited from Resource

new_subject

Methods included from Helpers::OrderedSetCollection

add_and_return_index, #each, #last, #size

Constructor Details

#initialize(options = {}) ⇒ ProvenanceResource

Build a new ProvenanceResource.

The subject can be either given as an argument or a new (random) subject is automatically set (see Resource for details).

A provenance_subject may not be given here.

Parameters:

  • options (Hash) (defaults to: {})

    a customizable set of options

Options Hash (options):

  • :subject (Fact::Subject) — default: new_subject

    Optional: the subject for the resource



15
16
17
# File 'lib/dbd/provenance_resource.rb', line 15

def initialize(options = {})
  super
end

Instance Method Details

#<<(provenance_fact) ⇒ Object

Add a ProvenanceFact.

  • if it has no subject, the subject is set in a duplicate provenance_fact
  • if is has the same subject as the resource, added unchanged.
  • if it has a different subject, a SubjectError is raised.


25
26
27
28
# File 'lib/dbd/provenance_resource.rb', line 25

def <<(provenance_fact)
  # TODO: check the type of the provenance_fact (ProvenanceFact)
  super
end