Class: R10K::Config
- Inherits:
-
Object
- Object
- R10K::Config
- Defined in:
- lib/r10k/config.rb,
lib/r10k/config/loader.rb
Defined Under Namespace
Classes: Loader
Instance Attribute Summary collapse
-
#configfile ⇒ Object
Returns the value of attribute configfile.
Instance Method Summary collapse
-
#dump ⇒ Object
Serve up the loaded config if it’s already been loaded, otherwise try to load a config in the current wd.
-
#load_config ⇒ Object
Load and store a config file, and set relevant options.
- #loaded? ⇒ Boolean
- #setting(key) ⇒ Object (also: #[])
Instance Attribute Details
#configfile ⇒ Object
Returns the value of attribute configfile.
6 7 8 |
# File 'lib/r10k/config.rb', line 6 def configfile @configfile end |
Instance Method Details
#dump ⇒ Object
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_config ⇒ Object
Load and store a config file, and set relevant options
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
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 |