Class: Fitting::Statistics::List
- Inherits:
-
Object
- Object
- Fitting::Statistics::List
- Defined in:
- lib/fitting/statistics/list.rb
Instance Method Summary collapse
-
#initialize(coverage, max_response_path, depth) ⇒ List
constructor
A new instance of List.
- #list_sort ⇒ Object
- #responses_stat(request) ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(coverage, max_response_path, depth) ⇒ List
Returns a new instance of List.
4 5 6 7 8 |
# File 'lib/fitting/statistics/list.rb', line 4 def initialize(coverage, max_response_path, depth) @coverage = coverage @max_response_path = max_response_path @depth = depth end |
Instance Method Details
#list_sort ⇒ Object
16 17 18 19 20 |
# File 'lib/fitting/statistics/list.rb', line 16 def list_sort @coverage.sort do |first, second| first.path.to_s <=> second.path.to_s end end |
#responses_stat(request) ⇒ Object
22 23 24 25 26 27 |
# File 'lib/fitting/statistics/list.rb', line 22 def responses_stat(request) tab = "\t" * ((@max_response_path - request.path.to_s.size / 8) + 3) tab + request.responses.to_a.each_with_object([]) do |response, res| response_stat(response, res) end.join(' ') end |
#to_s ⇒ Object
10 11 12 13 14 |
# File 'lib/fitting/statistics/list.rb', line 10 def to_s list_sort.inject([]) do |res, request| res.push("#{request.method}\t#{request.path}#{responses_stat(request)}") end.join("\n") end |