Class: Ralphttp::Fixit
- Inherits:
-
Object
- Object
- Ralphttp::Fixit
- Defined in:
- lib/ralphttp/fixit.rb
Overview
Public: Format data for a reasonable output
Direct Known Subclasses
Instance Attribute Summary collapse
-
#bucket ⇒ Object
Returns the value of attribute bucket.
-
#csv ⇒ Object
Returns the value of attribute csv.
-
#csvexport ⇒ Object
Returns the value of attribute csvexport.
-
#detailed ⇒ Object
Returns the value of attribute detailed.
-
#error ⇒ Object
Returns the value of attribute error.
-
#req ⇒ Object
Returns the value of attribute req.
-
#status ⇒ Object
Returns the value of attribute status.
-
#total_time ⇒ Object
Returns the value of attribute total_time.
Instance Method Summary collapse
-
#analyze ⇒ Object
Public: Analyze collected data and show reasonable output.
-
#display_results ⇒ Object
Public - Displays the results of the parsed data.
-
#initialize(options) ⇒ Fixit
constructor
Public: Start the class based on selected options.
-
#print_header ⇒ Object
Public: Output the header information.
Constructor Details
#initialize(options) ⇒ Fixit
Public: Start the class based on selected options
options - Hash containing settings
Returns nil
18 19 20 21 22 23 24 25 26 27 |
# File 'lib/ralphttp/fixit.rb', line 18 def initialize() @status = {} @error = [] @detailed = [:detail] unless [:csv].nil? @csv = [:csv] assign_csv_report end end |
Instance Attribute Details
#bucket ⇒ Object
Returns the value of attribute bucket.
7 8 9 |
# File 'lib/ralphttp/fixit.rb', line 7 def bucket @bucket end |
#csv ⇒ Object
Returns the value of attribute csv.
5 6 7 |
# File 'lib/ralphttp/fixit.rb', line 5 def csv @csv end |
#csvexport ⇒ Object
Returns the value of attribute csvexport.
6 7 8 |
# File 'lib/ralphttp/fixit.rb', line 6 def csvexport @csvexport end |
#detailed ⇒ Object
Returns the value of attribute detailed.
4 5 6 |
# File 'lib/ralphttp/fixit.rb', line 4 def detailed @detailed end |
#error ⇒ Object
Returns the value of attribute error.
10 11 12 |
# File 'lib/ralphttp/fixit.rb', line 10 def error @error end |
#req ⇒ Object
Returns the value of attribute req.
11 12 13 |
# File 'lib/ralphttp/fixit.rb', line 11 def req @req end |
#status ⇒ Object
Returns the value of attribute status.
9 10 11 |
# File 'lib/ralphttp/fixit.rb', line 9 def status @status end |
#total_time ⇒ Object
Returns the value of attribute total_time.
8 9 10 |
# File 'lib/ralphttp/fixit.rb', line 8 def total_time @total_time end |
Instance Method Details
#analyze ⇒ Object
Public: Analyze collected data and show reasonable output
Return Text output
32 33 34 35 36 37 38 39 40 41 |
# File 'lib/ralphttp/fixit.rb', line 32 def analyze if @error.empty? display_results else puts 'Errors encountered when connecting:' @error.each do |e| puts e end end end |
#display_results ⇒ Object
Public - Displays the results of the parsed data
Returns nil
46 47 48 49 50 51 |
# File 'lib/ralphttp/fixit.rb', line 46 def display_results print_header print_detailed_report write_csv_report display_status end |
#print_header ⇒ Object
Public: Output the header information
Returns nil
56 57 58 59 60 |
# File 'lib/ralphttp/fixit.rb', line 56 def print_header unless @detailed.nil? puts sprintf('%-30s %-10s %-10s', 'Time', 'Req/s', 'Avg resp (ms)') end end |