Class: Canals::Config
- Inherits:
-
Object
- Object
- Canals::Config
- Extended by:
- Forwardable
- Defined in:
- lib/canals/config.rb
Instance Method Summary collapse
-
#initialize(root = nil) ⇒ Config
constructor
A new instance of Config.
- #load_config(config_file) ⇒ Object
- #save! ⇒ Object
Constructor Details
Instance Method Details
#load_config(config_file) ⇒ Object
16 17 18 19 20 |
# File 'lib/canals/config.rb', line 16 def load_config(config_file) valid_file = config_file && config_file.exist? && !config_file.size.zero? return {} if !valid_file return Psych.load_file(config_file) end |
#save! ⇒ Object
22 23 24 25 26 27 |
# File 'lib/canals/config.rb', line 22 def save! FileUtils.mkdir_p(global_config_file.dirname) File.open(global_config_file, 'w') do |file| file.write(Psych.dump(@config)) end end |