module ROBundle::Provenance
This module is a mixin for Research Object provenance information.
To use this module simply provide an (optionally private) method named ‘structure’ which returns the internal fields of the object as a Hash.
Fields added by this mixin are:
-
:authoredBy
-
:authoredOn
-
:createdBy
-
:createdOn
Public Instance Methods
created_by → Agent
click to toggle source
Return the Agent that created this Research Object.
# File lib/ro-bundle/ro/provenance.rb, line 75 def created_by structure[:createdBy] end
created_by = new_creator
click to toggle source
Set the Agent that has created this RO Bundle. Anything passed to this method that is not an Agent will be converted to an Agent before setting the value.
# File lib/ro-bundle/ro/provenance.rb, line 85 def created_by=(new_creator) unless new_creator.instance_of?(Agent) new_creator = Agent.new(new_creator.to_s) end @edited = true structure[:createdBy] = new_creator end
created_on → Time
click to toggle source
Return the time that this RO Bundle was created as a Time object, or
nil
if not present in the manifest.
# File lib/ro-bundle/ro/provenance.rb, line 99 def created_on Util.parse_time(structure[:createdOn]) end
created_on = new_time
click to toggle source
Set a new createdOn time for this Manifest. Anything that Ruby can interpret as a time is accepted and converted to ISO8601 format on serialization.
# File lib/ro-bundle/ro/provenance.rb, line 109 def created_on=(new_time) @edited = true set_time(:createdOn, new_time) end