Module: PowerIQ::Configuration
- Defined in:
- lib/poweriq_client/configuration.rb
Constant Summary collapse
- DEFAULT_YAML_CONFIG =
File.join(ENV['HOME'],".poweriq_client")
Class Method Summary collapse
- .configure(options = nil, &block) ⇒ Object
- .host=(host) ⇒ Object
- .load_configuration(key, file = DEFAULT_YAML_CONFIG) ⇒ Object
- .password=(password) ⇒ Object
- .user=(user) ⇒ Object
Class Method Details
.configure(options = nil, &block) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/poweriq_client/configuration.rb', line 11 def configure(=nil,&block) unless(.nil?) .symbolize_keys! self.user = [:user] self.password = [:password] self.host = [:host] end if(block_given?) yield self end end |
.host=(host) ⇒ Object
28 29 30 |
# File 'lib/poweriq_client/configuration.rb', line 28 def host=(host) PowerIQ::Resource::Base.host = host end |
.load_configuration(key, file = DEFAULT_YAML_CONFIG) ⇒ Object
5 6 7 8 9 10 |
# File 'lib/poweriq_client/configuration.rb', line 5 def load_configuration(key,file=DEFAULT_YAML_CONFIG) config = YAML.load(File.read(file)) if(config && config.has_key?(key)) PowerIQ::Configuration.configure(config[key]) end end |