Class: CZTop::Config::Traversing::FamilyAccessor Abstract
- Inherits:
-
Object
- Object
- CZTop::Config::Traversing::FamilyAccessor
- Includes:
- Enumerable
- Defined in:
- lib/cztop/config/traversing.rb
Overview
This class is abstract.
Used to give access to a CZTop::Config item’s children or siblings.
Direct Known Subclasses
Instance Method Summary collapse
-
#==(other) ⇒ Object
Recursively compares these config items with the ones of the other.
-
#each {|config| ... } ⇒ Object
Yields all direct children/younger siblings.
-
#first ⇒ Config?
abstract
This is supposed to return the first relevant config item.
-
#initialize(config) ⇒ FamilyAccessor
constructor
A new instance of FamilyAccessor.
Constructor Details
#initialize(config) ⇒ FamilyAccessor
Returns a new instance of FamilyAccessor.
74 75 76 |
# File 'lib/cztop/config/traversing.rb', line 74 def initialize(config) @config = config end |
Instance Method Details
#==(other) ⇒ Object
Recursively compares these config items with the ones of the other.
104 105 106 107 108 109 110 111 |
# File 'lib/cztop/config/traversing.rb', line 104 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 true end |
#each {|config| ... } ⇒ Object
Yields all direct children/younger siblings. Starts with #first, if set.
88 89 90 91 92 93 94 95 96 97 98 99 |
# File 'lib/cztop/config/traversing.rb', line 88 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 ⇒ Config?
This method is abstract.
This is supposed to return the first relevant config item.
82 |
# File 'lib/cztop/config/traversing.rb', line 82 def first; end |