Module: Krikri::SoftwareAgent
- Extended by:
- ActiveSupport::Concern
- Included in:
- Enricher, Harvester, Indexer, Mapper::Agent
- Defined in:
- lib/krikri/software_agent.rb
Overview
SoftwareAgent is a mixin for logic common to code that generates a Krikri::Activity.
Defined Under Namespace
Modules: ClassMethods
Constant Summary collapse
- Logger =
ActiveSupport::TaggedLogging.new(Rails.logger)
Instance Method Summary collapse
-
#agent_name ⇒ String
Return an agent name suitable for saving in an Activity.
-
#entity_behavior ⇒ Object
Return the EntityBehavior associated with the SoftwareAgent.
- #log(priority, msg) ⇒ Object
-
#run ⇒ Boolean
abstract
‘true` if the run has succeeded; otherwise `false`.
Instance Method Details
#agent_name ⇒ String
Return an agent name suitable for saving in an Activity. This is the name of the most-derived class upon which this is invoked.
32 33 34 |
# File 'lib/krikri/software_agent.rb', line 32 def agent_name self.class.agent_name end |
#entity_behavior ⇒ Object
Return the EntityBehavior associated with the SoftwareAgent. Meant to be overridden as necessary.
22 23 24 |
# File 'lib/krikri/software_agent.rb', line 22 def entity_behavior @entity_behavior ||= nil end |
#log(priority, msg) ⇒ Object
52 53 54 |
# File 'lib/krikri/software_agent.rb', line 52 def log(priority, msg) self.class.log(priority, msg) end |
#run ⇒ Boolean
Perform this agent’s work. The method may accept an ‘activity_uri` to record as the Activity in provenance metadata. If so, the implementation must be optional and handle `nil` values by declining to record provenance
Returns ‘true` if the run has succeeded; otherwise `false`.
46 47 48 |
# File 'lib/krikri/software_agent.rb', line 46 def run fail NotImplementedError end |