Class: Flo::Config
- Inherits:
-
Object
- Object
- Flo::Config
- Defined in:
- lib/flo/config.rb
Overview
Instantiates and stores providers for use in command definitions
Defined Under Namespace
Classes: LazyCreds
Instance Attribute Summary collapse
- #cred_store ⇒ Object
-
#providers ⇒ Hash
readonly
Hash of provider instances.
Instance Method Summary collapse
-
#creds ⇒ LazyCred
Returns an object that responds to [], but instead of returning a value, returns a lambda that can be evaluated later in the context of the credentials for the provider.
-
#initialize ⇒ Config
constructor
A new instance of Config.
-
#provider(provider_sym, options = {}) { ... } ⇒ Object
Instantiate a provider and add it to the #providers collection accepts a block.
Constructor Details
#initialize ⇒ Config
Returns a new instance of Config.
32 33 34 |
# File 'lib/flo/config.rb', line 32 def initialize @providers = {} end |
Instance Attribute Details
#cred_store ⇒ Object
48 49 50 |
# File 'lib/flo/config.rb', line 48 def cred_store @cred_store ||= Flo::CredStore::YamlStore.new end |
#providers ⇒ Hash (readonly)
Hash of provider instances
15 16 17 |
# File 'lib/flo/config.rb', line 15 def providers @providers end |
Instance Method Details
#creds ⇒ LazyCred
Returns an object that responds to [], but instead of returning a value, returns a lambda that can be evaluated later in the context of the credentials for the provider
55 56 57 |
# File 'lib/flo/config.rb', line 55 def creds LazyCreds.new end |
#provider(provider_sym, options = {}) { ... } ⇒ Object
Instantiate a provider and add it to the #providers collection accepts a block
42 43 44 45 46 |
# File 'lib/flo/config.rb', line 42 def provider(provider_sym, ={}, &blk) provider = provider_class(provider_sym).new(, &blk) provider.cred_store = cred_store.credentials_for(provider_sym) @providers[provider_sym] = provider end |