Class: Watir::Base::Visitor

Inherits:
WebIDL::RubySexpVisitor
  • Object
show all
Defined in:
lib/watir-webdriver/generator/base/visitor.rb

Direct Known Subclasses

SVG::Visitor

Instance Method Summary collapse

Constructor Details

#initializeVisitor

Returns a new instance of Visitor.



5
6
7
8
9
10
11
12
13
# File 'lib/watir-webdriver/generator/base/visitor.rb', line 5

def initialize
  super

  # When an interface has multiple IDL definitions in the spec, the inheritance is sometimes
  # not repeated. So we'll keep track ourselves.
  @inheritance_map = {}

  @already_defined = []
end

Instance Method Details

#visit_implements_statement(stmt) ⇒ Object



47
48
49
# File 'lib/watir-webdriver/generator/base/visitor.rb', line 47

def visit_implements_statement(stmt)
  # ignored
end

#visit_interface(interface) ⇒ Object

WebIDL visitor interface



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/watir-webdriver/generator/base/visitor.rb', line 19

def visit_interface(interface)
  name   = interface.name
  parent = interface.inherits.first

  $stderr.puts name
  return if name !~ interface_regexp || name =~ /(Collection|Document)$/

  if force_inheritance.keys.include?(name)
    parent = force_inheritance[name]
  elsif parent
    @inheritance_map[name] ||= parent.name
    parent = parent.name
  else
    parent = @inheritance_map[name] || return
  end

  [ :scope,
    [:block,
      element_class(interface.name, extract_attributes(interface), parent),
      collection_class(interface.name)
    ]
  ]
end

#visit_module(mod) ⇒ Object



43
44
45
# File 'lib/watir-webdriver/generator/base/visitor.rb', line 43

def visit_module(mod)
  # ignored
end