Class: Krikri::EntityBehavior
- Inherits:
-
Object
- Object
- Krikri::EntityBehavior
- Defined in:
- lib/krikri/entity_behavior.rb
Overview
Base class for retrieval behaviors related to entities that were generated or revised by a ‘Krikri::Activity`.
A ‘SoftwareAgent` implements `#entity_behavior`, which returns an appropriate subclass of `EntityBehavior`. When an Activity is queried for its entities, it instantiates an instance of its particular `SoftwareAgent`, and then calls the `#entities` method of the agent’s entity behavior.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#activity ⇒ Object
readonly
Returns the value of attribute activity.
Class Method Summary collapse
-
.entities(activity, *args) ⇒ Object
Initializes an instance of this class with the given ‘Activity` and returns an enumerator of the associated entities.
Instance Method Summary collapse
-
#entities(*args) ⇒ Enumerator
Return an Enumerator of objects that have been affected by our @activity.
-
#initialize(activity) ⇒ EntityBehavior
constructor
A new instance of EntityBehavior.
Constructor Details
#initialize(activity) ⇒ EntityBehavior
Returns a new instance of EntityBehavior.
34 35 36 |
# File 'lib/krikri/entity_behavior.rb', line 34 def initialize(activity) @activity = activity end |
Instance Attribute Details
#activity ⇒ Object (readonly)
Returns the value of attribute activity.
30 31 32 |
# File 'lib/krikri/entity_behavior.rb', line 30 def activity @activity end |
Class Method Details
.entities(activity, *args) ⇒ Object
Initializes an instance of this class with the given ‘Activity` and returns an enumerator of the associated entities.
68 69 70 |
# File 'lib/krikri/entity_behavior.rb', line 68 def self.entities(activity, *args) new(activity).entities(*args) end |
Instance Method Details
#entities(*args) ⇒ Enumerator
Return an Enumerator of objects that have been affected by our @activity.
54 55 56 |
# File 'lib/krikri/entity_behavior.rb', line 54 def entities(*args) raise NotImplementedError end |