Class: Expedite::Agent
Overview
Definition of a Agent
Instance Attribute Summary collapse
-
#keep_alive ⇒ Object
If set to true, agent will be restarted automatically if it is killed.
-
#parent ⇒ Object
Name of the parent agent.
Instance Method Summary collapse
- #after(event, &block) ⇒ Object
-
#before(event, &block) ⇒ Object
Register a before event.
-
#initialize(parent: nil, keep_alive: false) ⇒ Agent
constructor
- parent
-
Name of parent agent.
Methods included from Hooks
#all_hooks, #clear_hooks, #hooks, #register_hook, #run_hook
Constructor Details
#initialize(parent: nil, keep_alive: false) ⇒ Agent
- parent
-
Name of parent agent.
- keep_alive
-
Specifies if the agent should be automatically restarted if it is terminated. Defaults to false.
22 23 24 25 |
# File 'lib/expedite/agents.rb', line 22 def initialize(parent: nil, keep_alive: false) @parent = parent @keep_alive = keep_alive end |
Instance Attribute Details
#keep_alive ⇒ Object
If set to true, agent will be restarted automatically if it is killed. Defaults to false.
17 18 19 |
# File 'lib/expedite/agents.rb', line 17 def keep_alive @keep_alive end |
#parent ⇒ Object
Name of the parent agent. This allows you to create agents from an existing agent. Defaults to nil.
12 13 14 |
# File 'lib/expedite/agents.rb', line 12 def parent @parent end |
Instance Method Details
#after(event, &block) ⇒ Object
34 35 36 |
# File 'lib/expedite/agents.rb', line 34 def after(event, &block) register_hook(:"after_#{event}", block) end |
#before(event, &block) ⇒ Object
Register a before event
30 31 32 |
# File 'lib/expedite/agents.rb', line 30 def before(event, &block) register_hook(:"before_#{event}", block) end |