Module: EphemeralResponse::Configuration
- Extended by:
- Configuration
- Included in:
- Configuration
- Defined in:
- lib/ephemeral_response/configuration.rb
Instance Attribute Summary collapse
- #fixture_directory ⇒ Object
-
#fixture_set ⇒ Object
Returns the value of attribute fixture_set.
- #skip_expiration ⇒ Object
Instance Method Summary collapse
- #debug_output ⇒ Object
-
#debug_output=(io) ⇒ Object
Set an IO object to receive the debugging information.
- #effective_directory ⇒ Object
- #expiration ⇒ Object
- #expiration=(expiration) ⇒ Object
- #host_registry ⇒ Object
- #register(host, &block) ⇒ Object
- #reset ⇒ Object
- #white_list ⇒ Object
- #white_list=(*hosts) ⇒ Object
Instance Attribute Details
#fixture_directory ⇒ Object
16 17 18 |
# File 'lib/ephemeral_response/configuration.rb', line 16 def fixture_directory @fixture_directory || "spec/fixtures/ephemeral_response" end |
#fixture_set ⇒ Object
Returns the value of attribute fixture_set.
5 6 7 |
# File 'lib/ephemeral_response/configuration.rb', line 5 def fixture_set @fixture_set end |
#skip_expiration ⇒ Object
62 63 64 |
# File 'lib/ephemeral_response/configuration.rb', line 62 def skip_expiration @skip_expiration || false end |
Instance Method Details
#debug_output ⇒ Object
29 30 31 |
# File 'lib/ephemeral_response/configuration.rb', line 29 def debug_output @debug_output ||= NullOutput.new end |
#debug_output=(io) ⇒ Object
Set an IO object to receive the debugging information.
21 22 23 24 25 26 27 |
# File 'lib/ephemeral_response/configuration.rb', line 21 def debug_output=(io) if io.respond_to?(:puts) @debug_output = io else raise Error, 'The debug_output object must respond to #puts' end end |
#effective_directory ⇒ Object
8 9 10 11 12 13 14 |
# File 'lib/ephemeral_response/configuration.rb', line 8 def effective_directory if fixture_set.nil? or fixture_set.to_s == 'default' fixture_directory else File.join(fixture_directory, fixture_set.to_s) end end |
#expiration ⇒ Object
40 41 42 |
# File 'lib/ephemeral_response/configuration.rb', line 40 def expiration @expiration || one_day end |
#expiration=(expiration) ⇒ Object
33 34 35 36 37 38 |
# File 'lib/ephemeral_response/configuration.rb', line 33 def expiration=(expiration) if expiration.is_a?(Proc) expiration = instance_eval &expiration end @expiration = validate_expiration(expiration) end |
#host_registry ⇒ Object
44 45 46 |
# File 'lib/ephemeral_response/configuration.rb', line 44 def host_registry @host_registry ||= Hash.new(proc {}) end |
#register(host, &block) ⇒ Object
48 49 50 |
# File 'lib/ephemeral_response/configuration.rb', line 48 def register(host, &block) host_registry[host] = block end |
#reset ⇒ Object
52 53 54 55 56 57 58 59 60 |
# File 'lib/ephemeral_response/configuration.rb', line 52 def reset @fixture_set = nil @expiration = nil @fixture_directory = nil @white_list = nil @skip_expiration = nil @host_registry = nil @debug_output = nil end |
#white_list ⇒ Object
66 67 68 |
# File 'lib/ephemeral_response/configuration.rb', line 66 def white_list @white_list ||= [] end |
#white_list=(*hosts) ⇒ Object
70 71 72 |
# File 'lib/ephemeral_response/configuration.rb', line 70 def white_list=(*hosts) @white_list = hosts.flatten end |