123456789_123456789_123456789_123456789_123456789_

Class: BiDiGenerate::VendorModule Private

Relationships & Source Files
Super Chains via Extension / Inclusion / Inheritance
Class Chain:
self, Struct
Instance Chain:
self, Struct
Inherits: Struct
  • Object
Defined in: rb/lib/selenium/webdriver/bidi/support/bidi_generate.rb

Overview

A namespaced group of browser-specific command extensions (e.g. Firefox's moz: fields), emitted as a subclass of the domain that overrides the extended commands. A subclass (rather than a runtime-mixed module) keeps the vendor signatures statically visible to type checkers, and is constructed directly (<Name>.new(source)) for a matching session — no factory or runtime mix-in.

Instance Attribute Summary

  • #commands rw Internal use only

    A namespaced group of browser-specific command extensions (e.g. Firefox's moz: fields), emitted as a subclass of the domain that overrides the extended commands.

  • #name rw Internal use only

    A namespaced group of browser-specific command extensions (e.g. Firefox's moz: fields), emitted as a subclass of the domain that overrides the extended commands.

  • #namespace rw Internal use only

    A namespaced group of browser-specific command extensions (e.g. Firefox's moz: fields), emitted as a subclass of the domain that overrides the extended commands.

  • #parent rw Internal use only

    A namespaced group of browser-specific command extensions (e.g. Firefox's moz: fields), emitted as a subclass of the domain that overrides the extended commands.

Instance Method Summary

Instance Attribute Details

#commands (rw)

A namespaced group of browser-specific command extensions (e.g. Firefox's moz: fields), emitted as a subclass of the domain that overrides the extended commands. A subclass (rather than a runtime-mixed module) keeps the vendor signatures statically visible to type checkers, and is constructed directly (<Name>.new(source)) for a matching session — no factory or runtime mix-in.

[ GitHub ]

  
# File 'rb/lib/selenium/webdriver/bidi/support/bidi_generate.rb', line 286

VendorModule = Struct.new(:name, :namespace, :parent, :commands, keyword_init: true)

#name (rw)

A namespaced group of browser-specific command extensions (e.g. Firefox's moz: fields), emitted as a subclass of the domain that overrides the extended commands. A subclass (rather than a runtime-mixed module) keeps the vendor signatures statically visible to type checkers, and is constructed directly (<Name>.new(source)) for a matching session — no factory or runtime mix-in.

[ GitHub ]

  
# File 'rb/lib/selenium/webdriver/bidi/support/bidi_generate.rb', line 286

VendorModule = Struct.new(:name, :namespace, :parent, :commands, keyword_init: true)

#namespace (rw)

A namespaced group of browser-specific command extensions (e.g. Firefox's moz: fields), emitted as a subclass of the domain that overrides the extended commands. A subclass (rather than a runtime-mixed module) keeps the vendor signatures statically visible to type checkers, and is constructed directly (<Name>.new(source)) for a matching session — no factory or runtime mix-in.

[ GitHub ]

  
# File 'rb/lib/selenium/webdriver/bidi/support/bidi_generate.rb', line 286

VendorModule = Struct.new(:name, :namespace, :parent, :commands, keyword_init: true)

#parent (rw)

A namespaced group of browser-specific command extensions (e.g. Firefox's moz: fields), emitted as a subclass of the domain that overrides the extended commands. A subclass (rather than a runtime-mixed module) keeps the vendor signatures statically visible to type checkers, and is constructed directly (<Name>.new(source)) for a matching session — no factory or runtime mix-in.

[ GitHub ]

  
# File 'rb/lib/selenium/webdriver/bidi/support/bidi_generate.rb', line 286

VendorModule = Struct.new(:name, :namespace, :parent, :commands, keyword_init: true)

Instance Method Details

#render(indent)

[ GitHub ]

  
# File 'rb/lib/selenium/webdriver/bidi/support/bidi_generate.rb', line 287

def render(indent)
  pad = ' ' * indent
  lines = [
    "#{pad}# @api private",
    "#{pad}# #{namespace}: vendor variant of #{parent}, overriding commands with browser-specific params.",
    "#{pad}# Construct #{name}.new(source) for a matching session; other sessions use #{parent}.",
    "#{pad}class #{name} < #{parent}"
  ]
  commands.each_with_index do |cmd, index|
    lines << '' unless index.zero?
    lines.concat(cmd.render_lines(indent + 2))
  end
  lines << "#{pad}end"
  lines.join("\n")
end