Class: KmsTools::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/kms-tools/config.rb

Class Method Summary collapse

Class Method Details

.configObject



8
9
10
# File 'lib/kms-tools/config.rb', line 8

def config
  config_data.to_hash
end

.config_dataObject



17
18
19
# File 'lib/kms-tools/config.rb', line 17

def config_data
  @config_data ||= Hashie::Mash.new
end

.load(path) ⇒ Object



12
13
14
15
# File 'lib/kms-tools/config.rb', line 12

def load(path)
  load_config(path)
  config
end

.load_config(file) ⇒ Object

Raises:

  • (MissingConfig)


27
28
29
30
# File 'lib/kms-tools/config.rb', line 27

def load_config(file)
  raise MissingConfig, "Missing configuration file: #{file}  Run help command for config file switch" unless File.exist?(file)
  config_data.merge! YAML.load_file(file)
end

.method_missing(method, args = false) ⇒ Object



22
23
24
# File 'lib/kms-tools/config.rb', line 22

def method_missing(method, args=false)
  config_data.send(method, args)
end