Class: LoadRunner::Runner
- Inherits:
-
Object
- Object
- LoadRunner::Runner
- Defined in:
- lib/load_runner/runner.rb
Overview
Executes event handlers
Instance Attribute Summary collapse
-
#handlers_dir ⇒ Object
Returns the value of attribute handlers_dir.
-
#opts ⇒ Object
readonly
Returns the value of attribute opts.
-
#response ⇒ Object
Returns the value of attribute response.
Instance Method Summary collapse
-
#execute ⇒ Object
Execute all matching handlers based on the input payload.
-
#initialize(opts) ⇒ Runner
constructor
A new instance of Runner.
Constructor Details
#initialize(opts) ⇒ Runner
Returns a new instance of Runner.
8 9 10 11 |
# File 'lib/load_runner/runner.rb', line 8 def initialize(opts) @handlers_dir = 'handlers' @opts = opts end |
Instance Attribute Details
#handlers_dir ⇒ Object
Returns the value of attribute handlers_dir.
6 7 8 |
# File 'lib/load_runner/runner.rb', line 6 def handlers_dir @handlers_dir end |
#opts ⇒ Object (readonly)
Returns the value of attribute opts.
5 6 7 |
# File 'lib/load_runner/runner.rb', line 5 def opts @opts end |
#response ⇒ Object
Returns the value of attribute response.
6 7 8 |
# File 'lib/load_runner/runner.rb', line 6 def response @response end |
Instance Method Details
#execute ⇒ Object
Execute all matching handlers based on the input payload. This method populates the ‘#response` object, and returns true on success.
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/load_runner/runner.rb', line 15 def execute set_environment_vars @response = opts.dup handlers = locate_handlers @response[:matching_handlers] = matching_handlers if handlers.empty? @response[:error] = "Could not find any handler to process this webhook. Please implement one of the 'matching_handlers'." return false else execute_all handlers @response[:executed_handlers] = handlers return true end end |