Class: SeaShanty::Configuration
- Inherits:
-
Object
- Object
- SeaShanty::Configuration
- Defined in:
- lib/sea_shanty/configuration.rb
Instance Attribute Summary collapse
-
#bypass ⇒ Object
(also: #bypass?)
Returns the value of attribute bypass.
-
#readonly ⇒ Object
(also: #readonly?)
Returns the value of attribute readonly.
-
#storage_dir ⇒ Object
Returns the value of attribute storage_dir.
Instance Method Summary collapse
- #generic_responses ⇒ Object
- #generic_responses=(responses) ⇒ Object
- #log=(destination) ⇒ Object
- #logger ⇒ Object
- #request_body_filter ⇒ Object
- #request_body_filter=(filter) ⇒ Object
- #request_headers_filter ⇒ Object
- #request_headers_filter=(filter) ⇒ Object
Instance Attribute Details
#bypass ⇒ Object Also known as: bypass?
Returns the value of attribute bypass.
8 9 10 |
# File 'lib/sea_shanty/configuration.rb', line 8 def bypass @bypass end |
#readonly ⇒ Object Also known as: readonly?
Returns the value of attribute readonly.
8 9 10 |
# File 'lib/sea_shanty/configuration.rb', line 8 def readonly @readonly end |
#storage_dir ⇒ Object
Returns the value of attribute storage_dir.
8 9 10 |
# File 'lib/sea_shanty/configuration.rb', line 8 def storage_dir @storage_dir end |
Instance Method Details
#generic_responses ⇒ Object
33 34 35 |
# File 'lib/sea_shanty/configuration.rb', line 33 def generic_responses @generic_responses ||= {} end |
#generic_responses=(responses) ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/sea_shanty/configuration.rb', line 20 def generic_responses=(responses) unless Hash === responses raise( ConfigurationError, "Generic responses must be a hash that maps a Regexp or something else that responds to `match?` to a relative path to a file with a recorded response." ) end raise ConfigurationError, "keys in the generic responses hash must respond to `match?`." unless responses.keys.all? { |key| key.respond_to?(:match?) } @generic_responses = responses end |
#log=(destination) ⇒ Object
12 13 14 |
# File 'lib/sea_shanty/configuration.rb', line 12 def log=(destination) @logger = Logger.new(destination) end |
#logger ⇒ Object
16 17 18 |
# File 'lib/sea_shanty/configuration.rb', line 16 def logger @logger ||= Logger::NullLogger.new end |
#request_body_filter ⇒ Object
43 44 45 |
# File 'lib/sea_shanty/configuration.rb', line 43 def request_body_filter @request_body_filter ||= lambda { |body| body } end |
#request_body_filter=(filter) ⇒ Object
37 38 39 40 41 |
# File 'lib/sea_shanty/configuration.rb', line 37 def request_body_filter=(filter) raise ConfigurationError, "Filter must have a call method" unless filter.respond_to?(:call) raise ConfigurationError, "Filter must have an arity of exactly 1" unless filter.arity == 1 @request_body_filter = filter end |
#request_headers_filter ⇒ Object
47 48 49 |
# File 'lib/sea_shanty/configuration.rb', line 47 def request_headers_filter @request_headers_filter ||= lambda { |key, value| value } end |
#request_headers_filter=(filter) ⇒ Object
51 52 53 54 55 |
# File 'lib/sea_shanty/configuration.rb', line 51 def request_headers_filter=(filter) raise ConfigurationError, "Filter must have a call method" unless filter.respond_to?(:call) raise ConfigurationError, "Filter must have an arity of exactly 2" unless filter.arity == 2 @request_headers_filter = filter end |