Class: Zombees::AbAdapter::Command

Inherits:
Object
  • Object
show all
Defined in:
lib/zombees/ab_adapter.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Command

Returns a new instance of Command.



42
43
44
45
46
47
48
# File 'lib/zombees/ab_adapter.rb', line 42

def initialize(options={})
  options = default.merge(options)
  @requests    = options[:requests]
  @concurrency = options[:concurrency]
  @url         = options[:url]
  @ab_options  = options[:ab_options]
end

Instance Attribute Details

#ab_optionsObject (readonly)

Returns the value of attribute ab_options.



40
41
42
# File 'lib/zombees/ab_adapter.rb', line 40

def ab_options
  @ab_options
end

#concurrencyObject (readonly)

Returns the value of attribute concurrency.



40
41
42
# File 'lib/zombees/ab_adapter.rb', line 40

def concurrency
  @concurrency
end

#requestsObject (readonly)

Returns the value of attribute requests.



40
41
42
# File 'lib/zombees/ab_adapter.rb', line 40

def requests
  @requests
end

#urlObject (readonly)

Returns the value of attribute url.



40
41
42
# File 'lib/zombees/ab_adapter.rb', line 40

def url
  @url
end

Instance Method Details

#commandObject



58
59
60
61
# File 'lib/zombees/ab_adapter.rb', line 58

def command
  "ab -r -n #{requests} -c #{concurrency} " +
  %Q{-C "sessionid=fake" #{ab_options} "#{url}"}
end

#defaultObject



50
51
52
# File 'lib/zombees/ab_adapter.rb', line 50

def default
  {}
end

#run(worker) ⇒ Object



54
55
56
# File 'lib/zombees/ab_adapter.rb', line 54

def run(worker)
  worker.run_command(command)
end