Class: Dupe::Network::Log

Inherits:
Object
  • Object
show all
Includes:
RestValidation
Defined in:
lib/superdupe/log.rb

Overview

:nodoc:

Defined Under Namespace

Classes: Request

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from RestValidation

#validate_request_type

Constructor Details

#initializeLog

:nodoc:



20
21
22
# File 'lib/superdupe/log.rb', line 20

def initialize     #:nodoc:
  @requests = []
end

Instance Attribute Details

#requestsObject (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_printObject



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

#resetObject

:nodoc:



33
34
35
# File 'lib/superdupe/log.rb', line 33

def reset #:nodoc:
  @requests = []
end