Class: Trample::Runner

Inherits:
Object
  • Object
show all
Includes:
Logging
Defined in:
lib/trample/runner.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Logging

#logger

Constructor Details

#initialize(config) ⇒ Runner

Returns a new instance of Runner.



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

def initialize(config)
  @config  = config
  @threads = []
end

Instance Attribute Details

#configObject (readonly)

Returns the value of attribute config.



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

def config
  @config
end

#threadsObject (readonly)

Returns the value of attribute threads.



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

def threads
  @threads
end

Instance Method Details

#trampleObject



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

def trample
  logger.info "Starting trample..."

  config.concurrency.times do
    thread = Thread.new(@config) do |c|
      Session.new(c).trample
    end
    threads << thread
  end

  threads.each { |t| t.join }

  logger.info "Trample completed..."
end