Class: Computron::Report

Inherits:
Object
  • Object
show all
Defined in:
lib/computron/report.rb

Defined Under Namespace

Classes: Request

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeReport

Returns a new instance of Report.



31
32
33
# File 'lib/computron/report.rb', line 31

def initialize
  @requests = []
end

Instance Attribute Details

#requestsObject (readonly)

Returns the value of attribute requests.



29
30
31
# File 'lib/computron/report.rb', line 29

def requests
  @requests
end

Instance Method Details

#by_statusObject



35
36
37
38
39
40
41
# File 'lib/computron/report.rb', line 35

def by_status
  requests.inject({}) do |memo, request|
    memo[request.response.status] ||= []
    memo[request.response.status] << request
    memo
  end
end

#sample(&block) ⇒ Object



43
44
45
# File 'lib/computron/report.rb', line 43

def sample(&block)
  requests << Request.new(&block)
end