Module: CloudConfig::Providers::ClassMethods
- Defined in:
- lib/cloud-config/providers.rb
Overview
Class methods for CloudConfig::Providers
Instance Attribute Summary collapse
- #Fetch provider configuration by setting key(providerconfigurationbysettingkey) ⇒ Hash<Symbol,ProviderConfig> readonly
- #Provider configurations(configurations) ⇒ Hash<Symbol,ProviderConfig> readonly
-
#providers ⇒ Object
readonly
Returns the value of attribute providers.
-
#providers_by_key ⇒ Object
readonly
Returns the value of attribute providers_by_key.
Instance Method Summary collapse
-
#provider(provider_name, provider_options = {}) { ... } ⇒ Object
Add a provider to the list of provider configurations.
-
#update_provider_keys(provider_config) ⇒ Object
Update #providers_by_key with settings from the provider config.
Instance Attribute Details
#Fetch provider configuration by setting key(providerconfigurationbysettingkey) ⇒ Hash<Symbol,ProviderConfig> (readonly)
19 |
# File 'lib/cloud-config/providers.rb', line 19 attr_reader :providers_by_key |
#Provider configurations(configurations) ⇒ Hash<Symbol,ProviderConfig> (readonly)
15 |
# File 'lib/cloud-config/providers.rb', line 15 attr_reader :providers |
#providers ⇒ Object (readonly)
Returns the value of attribute providers.
15 16 17 |
# File 'lib/cloud-config/providers.rb', line 15 def providers @providers end |
#providers_by_key ⇒ Object (readonly)
Returns the value of attribute providers_by_key.
19 20 21 |
# File 'lib/cloud-config/providers.rb', line 19 def providers_by_key @providers_by_key end |
Instance Method Details
#provider(provider_name, provider_options = {}) { ... } ⇒ Object
Add a provider to the list of provider configurations.
27 28 29 30 31 32 33 34 |
# File 'lib/cloud-config/providers.rb', line 27 def provider(provider_name, = {}, &blk) provider_config = ProviderConfig.new(provider_name, ) provider_config.instance_eval(&blk) if blk @providers ||= {} @providers[provider_name] = provider_config update_provider_keys(provider_config) end |
#update_provider_keys(provider_config) ⇒ Object
Update #providers_by_key with settings from the provider config.
39 40 41 42 43 44 |
# File 'lib/cloud-config/providers.rb', line 39 def update_provider_keys(provider_config) @providers_by_key ||= {} provider_config.settings.each_key do |key| @providers_by_key[key] = provider_config end end |