Class: Trample::Session

Inherits:
Object
  • Object
show all
Includes:
Logging, Timer
Defined in:
lib/trample/session.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Timer

#time

Methods included from Logging

#logger

Constructor Details

#initialize(config) ⇒ Session

Returns a new instance of Session.



8
9
10
11
12
# File 'lib/trample/session.rb', line 8

def initialize(config)
  @config         = config
  @response_times = []
  @cookies        = {}
end

Instance Attribute Details

#configObject (readonly)

Returns the value of attribute config.



6
7
8
# File 'lib/trample/session.rb', line 6

def config
  @config
end

#cookiesObject (readonly)

Returns the value of attribute cookies.



6
7
8
# File 'lib/trample/session.rb', line 6

def cookies
  @cookies
end

#last_responseObject (readonly)

Returns the value of attribute last_response.



6
7
8
# File 'lib/trample/session.rb', line 6

def last_response
  @last_response
end

#response_timesObject (readonly)

Returns the value of attribute response_times.



6
7
8
# File 'lib/trample/session.rb', line 6

def response_times
  @response_times
end

Instance Method Details

#trampleObject



14
15
16
17
18
19
20
21
22
# File 'lib/trample/session.rb', line 14

def trample
  hit @config. unless @config..nil?
  @config.iterations.times do
    @config.pages.each do |p|
      hit p
    end
  end
  sleep @config.sleep unless @config.sleep.nil?
end