Module: EphemeralResponse::Configuration
- Extended by:
- Configuration
- Included in:
- Configuration
- Defined in:
- lib/ephemeral_response/configuration.rb
Instance Attribute Summary collapse
Instance Method Summary collapse
- #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
7 8 9 |
# File 'lib/ephemeral_response/configuration.rb', line 7 def fixture_directory @fixture_directory || "spec/fixtures/ephemeral_response" end |
#skip_expiration ⇒ Object
38 39 40 |
# File 'lib/ephemeral_response/configuration.rb', line 38 def skip_expiration @skip_expiration || false end |
Instance Method Details
#expiration ⇒ Object
18 19 20 |
# File 'lib/ephemeral_response/configuration.rb', line 18 def expiration @expiration || one_day end |
#expiration=(expiration) ⇒ Object
11 12 13 14 15 16 |
# File 'lib/ephemeral_response/configuration.rb', line 11 def expiration=(expiration) if expiration.is_a?(Proc) expiration = instance_eval &expiration end @expiration = validate_expiration(expiration) end |
#host_registry ⇒ Object
22 23 24 |
# File 'lib/ephemeral_response/configuration.rb', line 22 def host_registry @host_registry ||= Hash.new(proc {}) end |
#register(host, &block) ⇒ Object
26 27 28 |
# File 'lib/ephemeral_response/configuration.rb', line 26 def register(host, &block) host_registry[host] = block end |
#reset ⇒ Object
30 31 32 33 34 35 36 |
# File 'lib/ephemeral_response/configuration.rb', line 30 def reset @expiration = nil @fixture_directory = nil @white_list = nil @skip_expiration = nil @host_registry = nil end |
#white_list ⇒ Object
42 43 44 |
# File 'lib/ephemeral_response/configuration.rb', line 42 def white_list @white_list ||= [] end |
#white_list=(*hosts) ⇒ Object
46 47 48 |
# File 'lib/ephemeral_response/configuration.rb', line 46 def white_list=(*hosts) @white_list = hosts.flatten end |