Class: Watir::HTML::Visitor
- Defined in:
- lib/watir-webdriver/html/visitor.rb
Instance Method Summary collapse
-
#initialize ⇒ Visitor
constructor
A new instance of Visitor.
- #visit_implements_statement(stmt) ⇒ Object
-
#visit_interface(interface) ⇒ Object
WebIDL visitor interface.
- #visit_module(mod) ⇒ Object
Constructor Details
#initialize ⇒ Visitor
Returns a new instance of Visitor.
7 8 9 10 11 12 13 14 15 |
# File 'lib/watir-webdriver/html/visitor.rb', line 7 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
49 50 51 |
# File 'lib/watir-webdriver/html/visitor.rb', line 49 def visit_implements_statement(stmt) # ignored end |
#visit_interface(interface) ⇒ Object
WebIDL visitor interface
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/watir-webdriver/html/visitor.rb', line 21 def visit_interface(interface) name = interface.name parent = interface.inherits.first $stderr.puts name return unless name =~ /^HTML/ && name !~ /(Collection|Document)$/ if name == "HTMLElement" parent = 'Element' elsif parent @inheritance_map[name] ||= parent.name parent = parent.name else parent = @inheritance_map[name] || return end [ :scope, [:block, element_class(interface.name, interface.members.select { |e| e.kind_of?(WebIDL::Ast::Attribute) }, parent), collection_class(interface.name) ] ] end |
#visit_module(mod) ⇒ Object
45 46 47 |
# File 'lib/watir-webdriver/html/visitor.rb', line 45 def visit_module(mod) # ignored end |