Class: Watir::Generator::Base::SpecExtractor

Inherits:
Object
  • Object
show all
Defined in:
lib/watir/generator/base/spec_extractor.rb

Direct Known Subclasses

HTML::SpecExtractor, SVG::SpecExtractor

Defined Under Namespace

Classes: InterfaceNotFound

Constant Summary collapse

IDL_SELECTOR =
"//pre[contains(@class, 'idl')]"

Instance Method Summary collapse

Constructor Details

#initialize(uri) ⇒ SpecExtractor

Returns a new instance of SpecExtractor.



11
12
13
# File 'lib/watir/generator/base/spec_extractor.rb', line 11

def initialize(uri)
  @uri = uri
end

Instance Method Details

#errorsObject



26
27
28
# File 'lib/watir/generator/base/spec_extractor.rb', line 26

def errors
  @errors ||= []
end

#fetch_interface(interface) ⇒ Object



47
48
49
# File 'lib/watir/generator/base/spec_extractor.rb', line 47

def fetch_interface(interface)
  @interfaces_by_name[interface] || raise(InterfaceNotFound, "#{interface} not found in IDL")
end


42
43
44
45
# File 'lib/watir/generator/base/spec_extractor.rb', line 42

def print_hierarchy
  process if @interfaces.nil?
  idl_sorter.print
end

#processObject



15
16
17
18
19
20
21
22
23
24
# File 'lib/watir/generator/base/spec_extractor.rb', line 15

def process
  download_and_parse
  extract_idl_parts
  extract_interface_map
  drop_issued_interfaces
  build_result
rescue StandardError
  p errors
  raise
end

#sorted_interfacesObject

returns a topoligically sorted array of WebIDL::Ast::Interface objects



34
35
36
37
38
39
40
# File 'lib/watir/generator/base/spec_extractor.rb', line 34

def sorted_interfaces
  process if @interfaces.nil?

  idl_sorter.sort.filter_map do |name|
    @interfaces.find { |i| i.name == name } || puts("ignoring interface: #{name}")
  end
end