Class: Rubikon::Config::YamlProvider
- Defined in:
- lib/rubikon/config/yaml_provider.rb
Overview
A configuration provider loading configuration data from YAML files
Class Method Summary collapse
-
.load_config(file) ⇒ Hash
Loads a configuration Hash from a YAML formatted file.
-
.save_config(config, file) ⇒ Object
Saves a configuration Hash into a YAML formatted file.
Class Method Details
.load_config(file) ⇒ Hash
Loads a configuration Hash from a YAML formatted file
22 23 24 |
# File 'lib/rubikon/config/yaml_provider.rb', line 22 def self.load_config(file) YAML.load_file file end |
.save_config(config, file) ⇒ Object
Saves a configuration Hash into a YAML formatted file
31 32 33 34 35 36 37 38 39 |
# File 'lib/rubikon/config/yaml_provider.rb', line 31 def self.save_config(config, file) unless config.is_a? Hash raise ArgumentError.new('Configuration has to be a Hash') end file = File.new file, 'w' YAML.dump config, file file.close end |