class CZTop::Config::Traversing::FamilyAccessor

Used to give access to a {Config} item's children or siblings. @abstract

Public Class Methods

new(config) click to toggle source

@param config [Config] the relative starting point (either parent or

an older sibling)
# File lib/cztop/config/traversing.rb, line 66
def initialize(config)
  @config = config
end

Public Instance Methods

==(other) click to toggle source

Recursively compares these config items with the ones of the other. @param other [FamilyAccessor]

# File lib/cztop/config/traversing.rb, line 91
def ==(other)
  these = to_a
  those = other.to_a
  these.size == those.size && these.zip(those) do |this, that|
    this.tree_equal?(that) or return false
  end
  return true
end
each() { |current| ... } click to toggle source

Yields all direct children/younger siblings. Starts with {#first}, if set. @yieldparam config [Config]

# File lib/cztop/config/traversing.rb, line 78
def each
  current = first()
  return if current.nil?
  yield current
  current_delegate = current.ffi_delegate
  while current_delegate = current_delegate.next
    break if current_delegate.null?
    yield CZTop::Config.from_ffi_delegate(current_delegate)
  end
end
first() click to toggle source

This is supposed to return the first relevant config item. @abstract @return [Config, nil]

# File lib/cztop/config/traversing.rb, line 73
def first; end