Class: Genesis::Agent
- Inherits:
-
Object
- Object
- Genesis::Agent
- Defined in:
- lib/genesis/agent.rb
Overview
Interface for a GenesisAgent Allows subclasess specifying agents in a DSL
Direct Known Subclasses
Class Attribute Summary collapse
-
.agents ⇒ Object
Returns the value of attribute agents.
Class Method Summary collapse
- .inherited(subclass) ⇒ Object
- .register_agent(**kwargs, &block) ⇒ Object (also: schedule)
- .reset! ⇒ Object
Class Attribute Details
.agents ⇒ Object
Returns the value of attribute agents.
6 7 8 |
# File 'lib/genesis/agent.rb', line 6 def agents @agents end |
Class Method Details
.inherited(subclass) ⇒ Object
15 16 17 18 |
# File 'lib/genesis/agent.rb', line 15 def inherited(subclass) subclass.reset! super end |
.register_agent(**kwargs, &block) ⇒ Object Also known as: schedule
7 8 9 |
# File 'lib/genesis/agent.rb', line 7 def register_agent(**kwargs, &block) @agents << { interval: kwargs[:interval] || 60, opts: kwargs, block: block } end |
.reset! ⇒ Object
11 12 13 |
# File 'lib/genesis/agent.rb', line 11 def reset! @agents = [] end |