Class: Ritm::Session
- Inherits:
-
Object
- Object
- Ritm::Session
- Defined in:
- lib/ritm/session.rb
Overview
Holds the context of a interception session. Changes in the context configuration should affect only this session
Instance Attribute Summary collapse
-
#conf ⇒ Object
readonly
Returns the value of attribute conf.
-
#dispatcher ⇒ Object
readonly
Returns the value of attribute dispatcher.
Instance Method Summary collapse
- #add_handler(handler) ⇒ Object
-
#configure(&block) ⇒ Object
Define configuration settings.
-
#disable ⇒ Object
Disable fuzzing (if it was enabled).
-
#enable ⇒ Object
Re-enable fuzzing (if it was disabled).
-
#initialize ⇒ Session
constructor
A new instance of Session.
- #on_request(&block) ⇒ Object
- #on_response(&block) ⇒ Object
-
#shutdown ⇒ Object
Shutdown the proxy service.
-
#start ⇒ Object
Start the proxy service.
Constructor Details
#initialize ⇒ Session
Returns a new instance of Session.
11 12 13 14 15 |
# File 'lib/ritm/session.rb', line 11 def initialize @conf = Configuration.new @dispatcher = Dispatcher.new @proxy = nil end |
Instance Attribute Details
#conf ⇒ Object (readonly)
Returns the value of attribute conf.
9 10 11 |
# File 'lib/ritm/session.rb', line 9 def conf @conf end |
#dispatcher ⇒ Object (readonly)
Returns the value of attribute dispatcher.
9 10 11 |
# File 'lib/ritm/session.rb', line 9 def dispatcher @dispatcher end |
Instance Method Details
#add_handler(handler) ⇒ Object
45 46 47 |
# File 'lib/ritm/session.rb', line 45 def add_handler(handler) dispatcher.add_handler(handler) end |
#configure(&block) ⇒ Object
Define configuration settings
18 19 20 |
# File 'lib/ritm/session.rb', line 18 def configure(&block) conf.instance_eval(&block) end |
#disable ⇒ Object
Disable fuzzing (if it was enabled)
28 29 30 |
# File 'lib/ritm/session.rb', line 28 def disable conf.disable end |
#enable ⇒ Object
Re-enable fuzzing (if it was disabled)
23 24 25 |
# File 'lib/ritm/session.rb', line 23 def enable conf.enable end |
#on_request(&block) ⇒ Object
49 50 51 |
# File 'lib/ritm/session.rb', line 49 def on_request(&block) dispatcher.on_request(&block) end |
#on_response(&block) ⇒ Object
53 54 55 |
# File 'lib/ritm/session.rb', line 53 def on_response(&block) dispatcher.on_response(&block) end |
#shutdown ⇒ Object
Shutdown the proxy service
40 41 42 43 |
# File 'lib/ritm/session.rb', line 40 def shutdown @proxy.shutdown unless @proxy.nil? @proxy = nil end |
#start ⇒ Object
Start the proxy service
33 34 35 36 37 |
# File 'lib/ritm/session.rb', line 33 def start raise 'Proxy already started' unless @proxy.nil? @proxy = Proxy::Launcher.new(self) @proxy.start end |