Module: Samuel::Diary
Instance Method Summary collapse
- #current_time ⇒ Object
- #record_request(http, request, time_requested = current_time) ⇒ Object
- #record_response(http, request, response, time_responded = current_time) ⇒ Object
Instance Method Details
#current_time ⇒ Object
16 17 18 |
# File 'lib/samuel/diary.rb', line 16 def current_time Time.now end |
#record_request(http, request, time_requested = current_time) ⇒ Object
5 6 7 8 |
# File 'lib/samuel/diary.rb', line 5 def record_request(http, request, time_requested = current_time) @requests ||= [] @requests.push({:request => request, :time_requested => time_requested}) end |
#record_response(http, request, response, time_responded = current_time) ⇒ Object
10 11 12 13 14 |
# File 'lib/samuel/diary.rb', line 10 def record_response(http, request, response, time_responded = current_time) time_requested = @requests.detect { |r| r[:request] == request }[:time_requested] @requests.reject! { |r| r[:request] == request } log_request_and_response(http, request, response, time_requested, time_responded) end |