Class: Dupe::Network::Log
- Inherits:
-
Object
- Object
- Dupe::Network::Log
- Includes:
- RestValidation
- Defined in:
- lib/superdupe/log.rb
Overview
:nodoc:
Defined Under Namespace
Classes: Request
Instance Attribute Summary collapse
-
#requests ⇒ Object
readonly
:nodoc:.
Instance Method Summary collapse
-
#add_request(verb, path, response_body = '') ⇒ Object
:nodoc:.
-
#initialize ⇒ Log
constructor
:nodoc:.
- #pretty_print ⇒ Object
-
#reset ⇒ Object
:nodoc:.
Methods included from RestValidation
Constructor Details
#initialize ⇒ Log
:nodoc:
20 21 22 |
# File 'lib/superdupe/log.rb', line 20 def initialize #:nodoc: @requests = [] end |
Instance Attribute Details
#requests ⇒ Object (readonly)
:nodoc:
5 6 7 |
# File 'lib/superdupe/log.rb', line 5 def requests @requests end |
Instance Method Details
#add_request(verb, path, response_body = '') ⇒ Object
:nodoc:
24 25 26 27 |
# File 'lib/superdupe/log.rb', line 24 def add_request(verb, path, response_body='') #:nodoc: validate_request_type verb @requests << Request.new(verb, path, response_body) end |
#pretty_print ⇒ Object
29 30 31 |
# File 'lib/superdupe/log.rb', line 29 def pretty_print "Logged Requests:\n" + requests.map {|r| r.pretty_print.indent }.join("\n\n") + "\n\n" end |
#reset ⇒ Object
:nodoc:
33 34 35 |
# File 'lib/superdupe/log.rb', line 33 def reset #:nodoc: @requests = [] end |