Class: CrossPost::Config::FileSubConfig
- Defined in:
- lib/cross-post/config.rb
Instance Method Summary collapse
-
#initialize(file) ⇒ FileSubConfig
constructor
A new instance of FileSubConfig.
- #put(key, value, save: false) ⇒ Object
- #save ⇒ Object
Methods inherited from SubConfig
Constructor Details
#initialize(file) ⇒ FileSubConfig
Returns a new instance of FileSubConfig.
79 80 81 82 |
# File 'lib/cross-post/config.rb', line 79 def initialize(file) @file = file super YAML.load_file @file end |
Instance Method Details
#put(key, value, save: false) ⇒ Object
84 85 86 87 |
# File 'lib/cross-post/config.rb', line 84 def put(key, value, save: false) self[key] = value self.save if save end |
#save ⇒ Object
89 90 91 92 93 |
# File 'lib/cross-post/config.rb', line 89 def save LOGGER.debug "Saving #{@file}" yaml = YAML.dump @config File.write @file, yaml end |