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.
10 11 12 13 14 15 16 |
# File 'lib/mach/configuration.rb', line 10 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.
8 9 10 |
# File 'lib/mach/configuration.rb', line 8 def credential_store @credential_store end |
#data_store ⇒ Object (readonly)
Returns the value of attribute data_store.
8 9 10 |
# File 'lib/mach/configuration.rb', line 8 def data_store @data_store end |
#ignore_validation_failure ⇒ Object (readonly)
Returns the value of attribute ignore_validation_failure.
8 9 10 |
# File 'lib/mach/configuration.rb', line 8 def ignore_validation_failure @ignore_validation_failure end |
#logger ⇒ Object (readonly)
Returns the value of attribute logger.
8 9 10 |
# File 'lib/mach/configuration.rb', line 8 def logger @logger end |
#stale_request_window ⇒ Object (readonly)
Returns the value of attribute stale_request_window.
8 9 10 |
# File 'lib/mach/configuration.rb', line 8 def stale_request_window @stale_request_window end |
Instance Method Details
#ignore_validation_failure! ⇒ Object
39 40 41 |
# File 'lib/mach/configuration.rb', line 39 def ignore_validation_failure! @ignore_validation_failure = true end |
#with_credential_store(store, options = {}) ⇒ Object
18 19 20 21 22 23 24 |
# File 'lib/mach/configuration.rb', line 18 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
26 27 28 29 |
# File 'lib/mach/configuration.rb', line 26 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
35 36 37 |
# File 'lib/mach/configuration.rb', line 35 def with_logger(logger) @logger = logger end |
#with_stale_request_window(num_seconds) ⇒ Object
31 32 33 |
# File 'lib/mach/configuration.rb', line 31 def with_stale_request_window(num_seconds) @stale_request_window = num_seconds end |