Class: Watir::HTML::IDLSorter

Inherits:
Object
  • Object
show all
Includes:
TSort
Defined in:
lib/watir-webdriver/html/idl_sorter.rb

Instance Method Summary (collapse)

Constructor Details

- (IDLSorter) initialize(interfaces)

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



21
22
23
24
# File 'lib/watir-webdriver/html/idl_sorter.rb', line 21

def print
  @visited = []
  sort.each { |node| print_node(node) }
end

- (Object) sort



26
27
28
# File 'lib/watir-webdriver/html/idl_sorter.rb', line 26

def sort
  tsort.reverse
end

- (Object) tsort_each_child(node, &blk)



34
35
36
# File 'lib/watir-webdriver/html/idl_sorter.rb', line 34

def tsort_each_child(node, &blk)
  @interfaces[node].each(&blk)
end

- (Object) tsort_each_node(&blk)



30
31
32
# File 'lib/watir-webdriver/html/idl_sorter.rb', line 30

def tsort_each_node(&blk)
  @interfaces.each_key(&blk)
end