Class: HttpStub::Controllers::StubActivatorController
- Inherits:
-
Object
- Object
- HttpStub::Controllers::StubActivatorController
- Defined in:
- lib/http_stub/controllers/stub_activator_controller.rb
Instance Method Summary collapse
- #activate(request) ⇒ Object
- #clear(request) ⇒ Object
-
#initialize(stub_activator_registry, stub_registry) ⇒ StubActivatorController
constructor
A new instance of StubActivatorController.
- #register(request) ⇒ Object
Constructor Details
#initialize(stub_activator_registry, stub_registry) ⇒ StubActivatorController
Returns a new instance of StubActivatorController.
6 7 8 9 |
# File 'lib/http_stub/controllers/stub_activator_controller.rb', line 6 def initialize(stub_activator_registry, stub_registry) @stub_activator_registry = stub_activator_registry @stub_registry = stub_registry end |
Instance Method Details
#activate(request) ⇒ Object
16 17 18 19 20 21 22 23 24 |
# File 'lib/http_stub/controllers/stub_activator_controller.rb', line 16 def activate(request) activator = @stub_activator_registry.find_for(request) if activator @stub_registry.add(activator.the_stub, request) HttpStub::Models::Response::SUCCESS else HttpStub::Models::Response::EMPTY end end |
#clear(request) ⇒ Object
26 27 28 |
# File 'lib/http_stub/controllers/stub_activator_controller.rb', line 26 def clear(request) @stub_activator_registry.clear(request) end |