Class: HttpMonkey::Configuration
- Inherits:
-
Object
- Object
- HttpMonkey::Configuration
show all
- Defined in:
- lib/http_monkey/configuration.rb
Defined Under Namespace
Classes: Behaviours, Middlewares
Instance Method Summary
collapse
Constructor Details
Returns a new instance of Configuration.
5
6
7
8
9
10
11
|
# File 'lib/http_monkey/configuration.rb', line 5
def initialize
net_adapter(:net_http)
@behaviours = HttpMonkey::Configuration::Behaviours.new
@behaviours.on_unknown { |client, req, response| response }
@middlewares = HttpMonkey::Configuration::Middlewares.new
end
|
Instance Method Details
#behaviours(&block) ⇒ Object
24
25
26
27
|
# File 'lib/http_monkey/configuration.rb', line 24
def behaviours(&block)
@behaviours.instance_eval(&block) if block_given?
@behaviours
end
|
#initialize_copy(source) ⇒ Object
13
14
15
16
17
|
# File 'lib/http_monkey/configuration.rb', line 13
def initialize_copy(source)
super
@behaviours = @behaviours.clone
@middlewares = @middlewares.clone
end
|
#middlewares(&block) ⇒ Object
29
30
31
32
|
# File 'lib/http_monkey/configuration.rb', line 29
def middlewares(&block)
@middlewares.instance_eval(&block) if block_given?
@middlewares
end
|
#net_adapter(adapter = nil) ⇒ Object
19
20
21
22
|
# File 'lib/http_monkey/configuration.rb', line 19
def net_adapter(adapter = nil)
@net_adapter = adapter unless adapter.nil?
@net_adapter
end
|