Class: BiDiGenerate::VendorCommand Private
| Relationships & Source Files | |
| Super Chains via Extension / Inclusion / Inheritance | |
|
Class Chain:
self,
Struct
|
|
|
Instance Chain:
self,
Struct
|
|
| Inherits: |
Struct
|
| Defined in: | rb/lib/selenium/webdriver/bidi/support/bidi_generate.rb |
Overview
A browser-specific extension to a command, kept out of the shared class so a non-matching browser never sees it. shared_params are the base command's own (required) params, forwarded verbatim; vendor_params are the typed extra fields, composed into the extensible params record's passthrough bag under their exact wire keys. params_class/result_ref/wire_name mirror the base command.
Instance Attribute Summary
-
#method_name
rw
Internal use only
A browser-specific extension to a command, kept out of the shared class so a non-matching browser never sees it.
-
#params_class
rw
Internal use only
A browser-specific extension to a command, kept out of the shared class so a non-matching browser never sees it.
-
#result_ref
rw
Internal use only
A browser-specific extension to a command, kept out of the shared class so a non-matching browser never sees it.
-
#shared_params
rw
Internal use only
A browser-specific extension to a command, kept out of the shared class so a non-matching browser never sees it.
-
#spec_href
rw
Internal use only
A browser-specific extension to a command, kept out of the shared class so a non-matching browser never sees it.
-
#vendor_params
rw
Internal use only
A browser-specific extension to a command, kept out of the shared class so a non-matching browser never sees it.
-
#wire_name
rw
Internal use only
A browser-specific extension to a command, kept out of the shared class so a non-matching browser never sees it.
Instance Method Summary
- #def_header(indent) Internal use only
- #doc_lines(pad) Internal use only
- #execute_line(body, indent) Internal use only
-
#extensions_lines(body, indent)
Internal use only
The extensible passthrough bag, carrying each set vendor field under its exact wire key.
- #params_line(body, indent) Internal use only
- #rbs_signature Internal use only
-
#render_lines(indent)
Internal use only
The full
def … endmethod block, fully indented fromindent.
Instance Attribute Details
#method_name (rw)
A browser-specific extension to a command, kept out of the shared class so a non-matching browser never sees it. shared_params are the base command's own (required) params, forwarded verbatim; vendor_params are the typed extra fields, composed into the extensible params record's passthrough bag under their exact wire keys. params_class/result_ref/wire_name mirror the base command.
# File 'rb/lib/selenium/webdriver/bidi/support/bidi_generate.rb', line 234
VendorCommand = Struct.new(:method_name, :wire_name, :result_ref, :params_class, :shared_params, :vendor_params, :spec_href, keyword_init: true)
#params_class (rw)
A browser-specific extension to a command, kept out of the shared class so a non-matching browser never sees it. shared_params are the base command's own (required) params, forwarded verbatim; vendor_params are the typed extra fields, composed into the extensible params record's passthrough bag under their exact wire keys. params_class/result_ref/wire_name mirror the base command.
# File 'rb/lib/selenium/webdriver/bidi/support/bidi_generate.rb', line 234
VendorCommand = Struct.new(:method_name, :wire_name, :result_ref, :params_class, :shared_params, :vendor_params, :spec_href, keyword_init: true)
#result_ref (rw)
A browser-specific extension to a command, kept out of the shared class so a non-matching browser never sees it. shared_params are the base command's own (required) params, forwarded verbatim; vendor_params are the typed extra fields, composed into the extensible params record's passthrough bag under their exact wire keys. params_class/result_ref/wire_name mirror the base command.
# File 'rb/lib/selenium/webdriver/bidi/support/bidi_generate.rb', line 234
VendorCommand = Struct.new(:method_name, :wire_name, :result_ref, :params_class, :shared_params, :vendor_params, :spec_href, keyword_init: true)
#spec_href (rw)
A browser-specific extension to a command, kept out of the shared class so a non-matching browser never sees it. shared_params are the base command's own (required) params, forwarded verbatim; vendor_params are the typed extra fields, composed into the extensible params record's passthrough bag under their exact wire keys. params_class/result_ref/wire_name mirror the base command.
# File 'rb/lib/selenium/webdriver/bidi/support/bidi_generate.rb', line 234
VendorCommand = Struct.new(:method_name, :wire_name, :result_ref, :params_class, :shared_params, :vendor_params, :spec_href, keyword_init: true)
#vendor_params (rw)
A browser-specific extension to a command, kept out of the shared class so a non-matching browser never sees it. shared_params are the base command's own (required) params, forwarded verbatim; vendor_params are the typed extra fields, composed into the extensible params record's passthrough bag under their exact wire keys. params_class/result_ref/wire_name mirror the base command.
# File 'rb/lib/selenium/webdriver/bidi/support/bidi_generate.rb', line 234
VendorCommand = Struct.new(:method_name, :wire_name, :result_ref, :params_class, :shared_params, :vendor_params, :spec_href, keyword_init: true)
#wire_name (rw)
A browser-specific extension to a command, kept out of the shared class so a non-matching browser never sees it. shared_params are the base command's own (required) params, forwarded verbatim; vendor_params are the typed extra fields, composed into the extensible params record's passthrough bag under their exact wire keys. params_class/result_ref/wire_name mirror the base command.
# File 'rb/lib/selenium/webdriver/bidi/support/bidi_generate.rb', line 234
VendorCommand = Struct.new(:method_name, :wire_name, :result_ref, :params_class, :shared_params, :vendor_params, :spec_href, keyword_init: true)
Instance Method Details
#def_header(indent)
[ GitHub ]# File 'rb/lib/selenium/webdriver/bidi/support/bidi_generate.rb', line 236
def def_header(indent) BiDiGenerate.wrap_call("def #{method_name}", shared_params.map(&:sig_part) + vendor_params.map(&:sig_part), indent) end
#doc_lines(pad)
[ GitHub ]# File 'rb/lib/selenium/webdriver/bidi/support/bidi_generate.rb', line 250
def doc_lines(pad) lines = ["#{pad}# @api private", "#{pad}# @see #{BiDiGenerate::BIDI_DOC_URL}"] lines << "#{pad}# @see #{spec_href}" if spec_href lines end
#execute_line(body, indent)
[ GitHub ]# File 'rb/lib/selenium/webdriver/bidi/support/bidi_generate.rb', line 268
def execute_line(body, indent) args = ["cmd: '#{wire_name}'", 'params: params'] args << "result: #{result_ref}" if result_ref "#{body}#{BiDiGenerate.wrap_call('execute', args, indent + 2)}" end
#extensions_lines(body, indent)
The extensible passthrough bag, carrying each set vendor field under its exact wire key.
# File 'rb/lib/selenium/webdriver/bidi/support/bidi_generate.rb', line 257
def extensions_lines(body, indent) inner = ' ' * (indent + 4) entries = vendor_params.map { |p| "#{inner}'#{p.wire_name}' => #{p.ruby_name}" }.join(",\n") ["#{body}extensions = {", entries, "#{body}}.reject { |_, value| Serialization::UNSET.equal?(value) }"] end
#params_line(body, indent)
[ GitHub ]# File 'rb/lib/selenium/webdriver/bidi/support/bidi_generate.rb', line 263
def params_line(body, indent) kwargs = shared_params.map { |p| "#{p.ruby_name}: #{p.ruby_name}" } + ['extensions: extensions'] "#{body}#{BiDiGenerate.wrap_call("params = #{params_class}.new", kwargs, indent + 2)}" end
#rbs_signature
[ GitHub ]# File 'rb/lib/selenium/webdriver/bidi/support/bidi_generate.rb', line 274
def rbs_signature params = (shared_params.map(&:rbs_part) + vendor_params.map(&:rbs_part)).join(', ') ret = result_ref ? "::Selenium::WebDriver::BiDi::Protocol::#{result_ref}" : 'untyped' "(#{params}) -> #{ret}" end
#render_lines(indent)
The full def … end method block, fully indented from indent. Optional vendor
fields are placed into the passthrough bag only when set (UNSET stays omitted), so
they serialize exactly like a field on the extensible record.
# File 'rb/lib/selenium/webdriver/bidi/support/bidi_generate.rb', line 244
def render_lines(indent) body = ' ' * (indent + 2) [*doc_lines(' ' * indent), "#{' ' * indent}#{def_header(indent)}", *extensions_lines(body, indent), params_line(body, indent), execute_line(body, indent), "#{' ' * indent}end"] end