Class: LoadRunner::Runner

Inherits:
Object
  • Object
show all
Defined in:
lib/load_runner/runner.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(opts) ⇒ Runner

Returns a new instance of Runner.



7
8
9
# File 'lib/load_runner/runner.rb', line 7

def initialize(opts)
  @opts = opts
end

Instance Attribute Details

#optsObject (readonly)

Returns the value of attribute opts.



4
5
6
# File 'lib/load_runner/runner.rb', line 4

def opts
  @opts
end

#responseObject

Returns the value of attribute response.



5
6
7
# File 'lib/load_runner/runner.rb', line 5

def response
  @response
end

Instance Method Details

#executeObject



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/load_runner/runner.rb', line 11

def execute
  set_environment_vars
  
  @response = opts.dup
  handlers = locate_handlers

  if handlers.empty?
    @response[:matching_handlers] = matching_handlers
    @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

#handlers_dirObject



28
29
30
# File 'lib/load_runner/runner.rb', line 28

def handlers_dir
  @handlers_dir ||= 'handlers'
end

#handlers_dir=(path) ⇒ Object



32
33
34
# File 'lib/load_runner/runner.rb', line 32

def handlers_dir=(path)
  @handlers_dir = path
end