Class: Watir::Generator::Base::Visitor
- Inherits:
-
WebIDL::RubySexpVisitor
- Object
- WebIDL::RubySexpVisitor
- Watir::Generator::Base::Visitor
- Defined in:
- lib/watir/generator/base/visitor.rb
Direct Known Subclasses
Constant Summary collapse
- STRING_TYPES =
['WindowProxy', 'ValidityState', 'TimeRanges', 'Location', 'Any', 'TimedTrackArray', 'TimedTrack', 'TextTrackArray', 'TextTrack', /Media.+/, 'TextTrackKind', 'Function', /.*EventHandler$/, 'Document', 'DocumentFragment', 'DOMTokenList', 'DOMSettableTokenList', 'DOMStringMap', 'HTMLPropertiesCollection', /HTML.*Element/, /HTML.*Collection/, 'CSSStyleDeclaration', /.+List$/, 'Date', 'Element', /DOM.+ReadOnly/, /SVGAnimated.+/, /SVG.*Element/, /SVG.*Collection/, 'SVGViewSpec', 'Object', 'USVString', 'DOMString', 'any'].freeze
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.
15 16 17 18 19 20 21 22 23 |
# File 'lib/watir/generator/base/visitor.rb', line 15 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
55 56 57 |
# File 'lib/watir/generator/base/visitor.rb', line 55 def visit_implements_statement(stmt) # ignored end |
#visit_interface(interface) ⇒ Object
WebIDL visitor interface
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/watir/generator/base/visitor.rb', line 29 def visit_interface(interface) name = interface.name parent = interface.inherits.first warn name return if name !~ interface_regexp || name =~ /(Collection|Document)$/ parent = if force_inheritance.key?(name) force_inheritance[name] else @inheritance_map[name] ||= parent&.name return unless @inheritance_map[name] @inheritance_map[name] end [:scope, [:block, element_class(interface.name, extract_attributes(interface), parent), collection_class(interface.name)]] end |
#visit_module(mod) ⇒ Object
51 52 53 |
# File 'lib/watir/generator/base/visitor.rb', line 51 def visit_module(mod) # ignored end |