Class: Krikri::EntityBehavior
- Inherits:
-
Object
- Object
- Krikri::EntityBehavior
- Defined in:
- lib/krikri/entity_behavior.rb
Overview
Base class for behaviors related to entities that are generated or revised by activities.
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
Instance Method Summary collapse
-
#entities ⇒ 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.
17 18 19 |
# File 'lib/krikri/entity_behavior.rb', line 17 def initialize(activity) @activity = activity end |
Instance Attribute Details
#activity ⇒ Object (readonly)
Returns the value of attribute activity.
16 17 18 |
# File 'lib/krikri/entity_behavior.rb', line 16 def activity @activity end |
Class Method Details
.entities(activity) ⇒ Object
36 37 38 |
# File 'lib/krikri/entity_behavior.rb', line 36 def self.entities(activity) new(activity).entities end |
Instance Method Details
#entities ⇒ Enumerator
Return an Enumerator of objects that have been affected by our @activity.
28 29 30 |
# File 'lib/krikri/entity_behavior.rb', line 28 def entities raise NotImplementedError end |