Class: Cluster::Configuration

Inherits:
Object
  • Object
show all
Includes:
Logging
Defined in:
lib/cluster/configuration.rb

Constant Summary collapse

@@system_config =
{}
@@credentials =
nil

Class Method Summary collapse

Methods included from Logging

#logger

Class Method Details

.[](key) ⇒ Object



33
34
35
# File 'lib/cluster/configuration.rb', line 33

def [](key)
  @@system_config[key.to_s]
end

.[]=(key, value) ⇒ Object



29
30
31
# File 'lib/cluster/configuration.rb', line 29

def []=(key, value)
  @@system_config[key.to_s] = value
end

.credentialsObject



25
26
27
# File 'lib/cluster/configuration.rb', line 25

def credentials
  @@credentials ||= credentials? && File.open(self[:credentials_file]) {|f| YAML::load(f) }
end

.credentials?Boolean

Returns:

  • (Boolean)


21
22
23
# File 'lib/cluster/configuration.rb', line 21

def credentials?
  self[:credentials_file]
end

.method_missing(meth, *params) ⇒ Object



37
38
39
40
41
42
43
44
# File 'lib/cluster/configuration.rb', line 37

def method_missing(meth, *params)
  field = meth.to_s
  if options.respond_to? field
    options.send(field)
  else
    super
  end
end

.options(params = nil) ⇒ Object



46
47
48
# File 'lib/cluster/configuration.rb', line 46

def options(params = nil)
  @@system_config ||= self.new(params)
end