Module: Artifice
- Defined in:
- lib/artifice.rb
Defined Under Namespace
Modules: Net
Constant Summary collapse
- NET_HTTP =
::Net::HTTP
Class Method Summary collapse
-
.activate_with(endpoint) { ... } ⇒ Object
Activate Artifice with a particular Rack endpoint.
-
.deactivate ⇒ Object
Deactivate the Artifice replacement.
Class Method Details
.activate_with(endpoint) { ... } ⇒ Object
Activate Artifice with a particular Rack endpoint.
Calling this method will replace the Net::HTTP system with a replacement that routes all requests to the Rack endpoint.
18 19 20 21 22 23 24 25 26 |
# File 'lib/artifice.rb', line 18 def self.activate_with(endpoint) Net::HTTP.endpoint = endpoint replace_net_http(Artifice::Net::HTTP) if block_given? yield deactivate end end |
.deactivate ⇒ Object
Deactivate the Artifice replacement.
29 30 31 |
# File 'lib/artifice.rb', line 29 def self.deactivate replace_net_http(NET_HTTP) end |