Class: CFA::AugeasTreeValue

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

Overview

Represents a node that contains both a value and a subtree below it. For easier traversal it forwards ‘#[]` to the subtree.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(tree, value) ⇒ AugeasTreeValue



168
169
170
171
172
# File 'lib/cfa/augeas_parser.rb', line 168

def initialize(tree, value)
  @tree = tree
  @value = value
  @modified = false
end

Instance Attribute Details

#treeAugeasTree



166
167
168
# File 'lib/cfa/augeas_parser.rb', line 166

def tree
  @tree
end

#valueString



164
165
166
# File 'lib/cfa/augeas_parser.rb', line 164

def value
  @value
end

Instance Method Details

#==(other) ⇒ Object Also known as: eql?



184
185
186
187
188
# File 'lib/cfa/augeas_parser.rb', line 184

def ==(other)
  [:class, :value, :tree].all? do |a|
    public_send(a) == other.public_send(a)
  end
end

#[](key) ⇒ String, ...

Finds given key in tree.



175
176
177
# File 'lib/cfa/augeas_parser.rb', line 175

def [](key)
  tree[key]
end

#modified?Boolean



191
192
193
# File 'lib/cfa/augeas_parser.rb', line 191

def modified?
  @modified
end