Class: R10K::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/r10k/config.rb,
lib/r10k/config/loader.rb

Defined Under Namespace

Classes: Loader

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#configfileObject

Returns the value of attribute configfile.



6
7
8
# File 'lib/r10k/config.rb', line 6

def configfile
  @configfile
end

Instance Method Details

#dumpObject

Serve up the loaded config if it’s already been loaded, otherwise try to load a config in the current wd.



14
15
16
17
# File 'lib/r10k/config.rb', line 14

def dump
  load_config unless @config
  @config
end

#load_configObject

Load and store a config file, and set relevant options

Parameters:

  • configfile (String)

    The path to the YAML config file



27
28
29
30
31
32
33
34
35
# File 'lib/r10k/config.rb', line 27

def load_config
  unless @configfile
    loader = R10K::Config::Loader.new
    @configfile = loader.search
  end
  File.open(@configfile) { |fh| @config = YAML.load(fh.read) }
  apply_config_settings
  @config
end

#loaded?Boolean

Returns:

  • (Boolean)


8
9
10
# File 'lib/r10k/config.rb', line 8

def loaded?
  !(@config.nil?)
end

#setting(key) ⇒ Object Also known as: []



19
20
21
# File 'lib/r10k/config.rb', line 19

def setting(key)
  self.dump[key]
end