Class: Krikri::Harvesters::HarvestBehavior
- Inherits:
-
Object
- Object
- Krikri::Harvesters::HarvestBehavior
- Defined in:
- lib/krikri/harvesters/harvest_behavior.rb
Overview
Defines an interface for handling records during the harvest process. Subclasses specify behavior by implementing ‘#process_record`.
Behaviors should be implemented idempotently so they can be safely retried on errors.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#activity_uri ⇒ Object
readonly
a URI identifying the activity responsible for invoking the behavior.
-
#record ⇒ Object
readonly
Returns the value of attribute record.
Class Method Summary collapse
-
.process_record(record, activity_uri) ⇒ Object
Creates a new instance of this behavior with the given arguments and calls ‘#process_record`.
Instance Method Summary collapse
-
#initialize(record, activity_uri) ⇒ HarvestBehavior
constructor
A new instance of HarvestBehavior.
Constructor Details
#initialize(record, activity_uri) ⇒ HarvestBehavior
Returns a new instance of HarvestBehavior.
24 25 26 27 |
# File 'lib/krikri/harvesters/harvest_behavior.rb', line 24 def initialize(record, activity_uri) @record = record @activity_uri = activity_uri end |
Instance Attribute Details
#activity_uri ⇒ Object (readonly)
a URI identifying the activity responsible for invoking the behavior
22 23 24 |
# File 'lib/krikri/harvesters/harvest_behavior.rb', line 22 def activity_uri @activity_uri end |
#record ⇒ Object (readonly)
Returns the value of attribute record.
22 |
# File 'lib/krikri/harvesters/harvest_behavior.rb', line 22 attr_reader :activity_uri, :record |
Class Method Details
.process_record(record, activity_uri) ⇒ Object
Creates a new instance of this behavior with the given arguments and calls ‘#process_record`.
36 37 38 |
# File 'lib/krikri/harvesters/harvest_behavior.rb', line 36 def self.process_record(record, activity_uri) new(record, activity_uri).process_record end |