Class: CFA::AugeasWriter Private
- Inherits:
-
Object
- Object
- CFA::AugeasWriter
- Defined in:
- lib/cfa/augeas_parser/writer.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
internal only, unstable API
The goal of this class is to write the data stored in AugeasTree back to Augeas.
It tries to make only the needed changes, as internally Augeas keeps a flag whether data has been modified, and keeps the unmodified parts of the file untouched.
Defined Under Namespace
Classes: LazyOperations, LocatedEntry
Instance Method Summary collapse
-
#initialize(aug) ⇒ AugeasWriter
constructor
private
A new instance of AugeasWriter.
-
#write(prefix, tree, top_level: true) ⇒ Object
private
Writes the data in tree to a given prefix in Augeas.
Constructor Details
#initialize(aug) ⇒ AugeasWriter
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of AugeasWriter.
13 14 15 |
# File 'lib/cfa/augeas_parser/writer.rb', line 13 def initialize(aug) @aug = aug end |
Instance Method Details
#write(prefix, tree, top_level: true) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Writes the data in tree to a given prefix in Augeas
20 21 22 23 24 25 26 27 |
# File 'lib/cfa/augeas_parser/writer.rb', line 20 def write(prefix, tree, top_level: true) @lazy_operations = LazyOperations.new(aug) if top_level tree.all_data.each do |entry| located_entry = LocatedEntry.new(tree, entry, prefix) process_operation(located_entry) end @lazy_operations.run if top_level end |