Class: CFA::AugeasElement

Inherits:
Hash
  • Object
show all
Defined in:
lib/cfa/augeas_parser.rb

Overview

TODO:

Unify naming: entry, element

A building block for AugeasTree.

Intuitively the tree is made of hashes where keys may be duplicated, so it is implemented as a sequence of hashes with two keys, :key and :value.

A ‘:key` is a String. The key may have a collection suffix “[]”. Note that in contrast with the underlying Augeas library, an integer index is not present (which should make it easier to modify collections of elements).

A ‘:value` is either a String, or an AugeasTree, or an AugeasTreeValue (which combines both).

An ‘:operation` is an internal variable holding modification of Augeas structure. It is used for minimizing modifications of source files. Its possible values are

  • ‘:keep` when the value is untouched

  • ‘:modify` when the `:value` changed but the `:key` is the same

  • ‘:remove` when it is going to be removed, and

  • ‘:add` when a new element is added.

An ‘:orig_key` is an internal variable used to hold the original key including its index.

Returns: