Class: Puppet::Util::NetworkDevice::Sorter
- Inherits:
-
Object
- Object
- Puppet::Util::NetworkDevice::Sorter
- Includes:
- TSort
- Defined in:
- lib/puppet/util/network_device/sorter.rb
Instance Method Summary collapse
-
#initialize(param) ⇒ Sorter
constructor
A new instance of Sorter.
- #tsort_each_child(param, &block) ⇒ Object
- #tsort_each_node(&block) ⇒ Object
Constructor Details
#initialize(param) ⇒ Sorter
Returns a new instance of Sorter.
7 8 9 |
# File 'lib/puppet/util/network_device/sorter.rb', line 7 def initialize(param) @param = param end |
Instance Method Details
#tsort_each_child(param, &block) ⇒ Object
15 16 17 18 19 20 21 |
# File 'lib/puppet/util/network_device/sorter.rb', line 15 def tsort_each_child(param, &block) @param.each_value.select { |i| next unless i.respond_to?(:before) && i.respond_to?(:after) next unless param.respond_to?(:after) i.before == param.name || i.name == param.after }.each(&block) end |
#tsort_each_node(&block) ⇒ Object
11 12 13 |
# File 'lib/puppet/util/network_device/sorter.rb', line 11 def tsort_each_node(&block) @param.each_value(&block) end |