Class: Krikri::EntityBehavior

Inherits:
Object
  • Object
show all
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.

See Also:

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

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

#activityObject (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

#entitiesEnumerator

Return an Enumerator of objects that have been affected by our @activity.

Returns:

  • (Enumerator)

    objects

Raises:

  • (NotImplementedError)

See Also:



28
29
30
# File 'lib/krikri/entity_behavior.rb', line 28

def entities
  raise NotImplementedError 
end