Class: Watir::HTML::IDLSorter
- Includes:
- TSort
- Defined in:
- lib/watir-webdriver/html/idl_sorter.rb
Instance Method Summary collapse
-
#initialize(interfaces) ⇒ IDLSorter
constructor
A new instance of IDLSorter.
- #print ⇒ Object
- #sort ⇒ Object
- #tsort_each_child(node, &blk) ⇒ Object
- #tsort_each_node(&blk) ⇒ Object
Constructor Details
#initialize(interfaces) ⇒ IDLSorter
Returns a new instance of IDLSorter.
10 11 12 13 14 15 16 17 18 19 |
# File 'lib/watir-webdriver/html/idl_sorter.rb', line 10 def initialize(interfaces) @interfaces = {} interfaces.each do |interface| @interfaces[interface.name] ||= [] interface.inherits.each do |inherit| (@interfaces[inherit.name] ||= []) << interface.name end end end |
Instance Method Details
#print ⇒ Object
21 22 23 24 |
# File 'lib/watir-webdriver/html/idl_sorter.rb', line 21 def print @visited = [] sort.each { |node| print_node(node) } end |
#sort ⇒ Object
26 27 28 |
# File 'lib/watir-webdriver/html/idl_sorter.rb', line 26 def sort tsort.reverse end |
#tsort_each_child(node, &blk) ⇒ Object
34 35 36 |
# File 'lib/watir-webdriver/html/idl_sorter.rb', line 34 def tsort_each_child(node, &blk) @interfaces[node].each(&blk) end |
#tsort_each_node(&blk) ⇒ Object
30 31 32 |
# File 'lib/watir-webdriver/html/idl_sorter.rb', line 30 def tsort_each_node(&blk) @interfaces.each_key(&blk) end |