Class: NetObserver::LastRequest

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/net_observer/last_request.rb

Overview

NetObserver::Logger.new Logger.new STDOUT

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#last_requestObject (readonly)

Returns the value of attribute last_request.



13
14
15
# File 'lib/net_observer/last_request.rb', line 13

def last_request
  @last_request
end

Instance Method Details

#disableObject



21
22
23
24
# File 'lib/net_observer/last_request.rb', line 21

def disable
	@last_request = nil
	Base.instance.delete_observer(self)
end

#enableObject

@param(Logger) logger which recieve informations about communication



16
17
18
19
# File 'lib/net_observer/last_request.rb', line 16

def enable
	@last_request = nil
	Base.instance.add_observer(self)
end

#update(type, request, body, connection) ⇒ Object



27
28
29
30
31
32
33
34
# File 'lib/net_observer/last_request.rb', line 27

def update(type, request, body, connection)
	case type
	when :response
		return #don't care
	when :request
		@last_request = { :connection => connection, :request => request, :body => (request.body || body)}
	end
end