Class: Mach::Configuration
- Inherits:
-
Object
- Object
- Mach::Configuration
- Defined in:
- lib/mach/configuration.rb
Instance Attribute Summary collapse
-
#credential_store ⇒ Object
readonly
Returns the value of attribute credential_store.
-
#data_store ⇒ Object
readonly
Returns the value of attribute data_store.
-
#ignore_validation_failure ⇒ Object
readonly
Returns the value of attribute ignore_validation_failure.
-
#logger ⇒ Object
readonly
Returns the value of attribute logger.
-
#stale_request_window ⇒ Object
readonly
Returns the value of attribute stale_request_window.
Instance Method Summary collapse
- #ignore_validation_failure! ⇒ Object
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #with_credential_store(store, options = {}) ⇒ Object
- #with_data_store(store_identifier, options = {}) ⇒ Object
- #with_logger(logger) ⇒ Object
- #with_stale_request_window(num_seconds) ⇒ Object
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
11 12 13 14 15 16 17 |
# File 'lib/mach/configuration.rb', line 11 def initialize @stale_request_window = 10 @data_store = Mach::Persistence::InMemoryStore.configure({}) @credential_store = Hash.new @ignore_validation_failure = false @logger = ::Logger.new(STDOUT) end |
Instance Attribute Details
#credential_store ⇒ Object (readonly)
Returns the value of attribute credential_store.
9 10 11 |
# File 'lib/mach/configuration.rb', line 9 def credential_store @credential_store end |
#data_store ⇒ Object (readonly)
Returns the value of attribute data_store.
9 10 11 |
# File 'lib/mach/configuration.rb', line 9 def data_store @data_store end |
#ignore_validation_failure ⇒ Object (readonly)
Returns the value of attribute ignore_validation_failure.
9 10 11 |
# File 'lib/mach/configuration.rb', line 9 def ignore_validation_failure @ignore_validation_failure end |
#logger ⇒ Object (readonly)
Returns the value of attribute logger.
9 10 11 |
# File 'lib/mach/configuration.rb', line 9 def logger @logger end |
#stale_request_window ⇒ Object (readonly)
Returns the value of attribute stale_request_window.
9 10 11 |
# File 'lib/mach/configuration.rb', line 9 def stale_request_window @stale_request_window end |
Instance Method Details
#ignore_validation_failure! ⇒ Object
40 41 42 |
# File 'lib/mach/configuration.rb', line 40 def ignore_validation_failure! @ignore_validation_failure = true end |
#with_credential_store(store, options = {}) ⇒ Object
19 20 21 22 23 24 25 |
# File 'lib/mach/configuration.rb', line 19 def with_credential_store(store, = {}) @credential_store = store #store_class = CredentialStore::Adapter.const_get(camelize(store_type.to_s)) #@credential_store = store_class.new(options) # find out if we should use redis store first #@credential_store = CredentialStore::Adapter::Redis.new() #todo pass options end |
#with_data_store(store_identifier, options = {}) ⇒ Object
27 28 29 30 |
# File 'lib/mach/configuration.rb', line 27 def with_data_store(store_identifier, = {}) store_class = Mach::Persistence.const_get(camelize("#{store_identifier.to_s}_store")) @data_store = store_class.configure() end |
#with_logger(logger) ⇒ Object
36 37 38 |
# File 'lib/mach/configuration.rb', line 36 def with_logger(logger) @logger = logger end |
#with_stale_request_window(num_seconds) ⇒ Object
32 33 34 |
# File 'lib/mach/configuration.rb', line 32 def with_stale_request_window(num_seconds) @stale_request_window = num_seconds end |