Class: BiDiGenerate::VendorCommand Private
- Inherits:
-
Struct
- Object
- Struct
- BiDiGenerate::VendorCommand
- Defined in:
- rb/lib/selenium/webdriver/bidi/support/bidi_generate.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
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 collapse
-
#method_name ⇒ Object
Returns the value of attribute method_name.
-
#params_class ⇒ Object
Returns the value of attribute params_class.
-
#result_ref ⇒ Object
Returns the value of attribute result_ref.
-
#shared_params ⇒ Object
Returns the value of attribute shared_params.
-
#spec_href ⇒ Object
Returns the value of attribute spec_href.
-
#vendor_params ⇒ Object
Returns the value of attribute vendor_params.
-
#wire_name ⇒ Object
Returns the value of attribute wire_name.
Instance Method Summary collapse
- #def_header(indent) ⇒ Object private
- #doc_lines(pad) ⇒ Object private
- #execute_line(body, indent) ⇒ Object private
-
#extensions_lines(body, indent) ⇒ Object
private
The extensible passthrough bag, carrying each set vendor field under its exact wire key.
- #params_line(body, indent) ⇒ Object private
- #rbs_signature ⇒ Object private
-
#render_lines(indent) ⇒ Object
private
The full
def … endmethod block, fully indented fromindent.
Instance Attribute Details
#method_name ⇒ Object
Returns the value of attribute method_name
259 260 261 |
# File 'rb/lib/selenium/webdriver/bidi/support/bidi_generate.rb', line 259 def method_name @method_name end |
#params_class ⇒ Object
Returns the value of attribute params_class
259 260 261 |
# File 'rb/lib/selenium/webdriver/bidi/support/bidi_generate.rb', line 259 def params_class @params_class end |
#result_ref ⇒ Object
Returns the value of attribute result_ref
259 260 261 |
# File 'rb/lib/selenium/webdriver/bidi/support/bidi_generate.rb', line 259 def result_ref @result_ref end |
#shared_params ⇒ Object
Returns the value of attribute shared_params
259 260 261 |
# File 'rb/lib/selenium/webdriver/bidi/support/bidi_generate.rb', line 259 def shared_params @shared_params end |
#spec_href ⇒ Object
Returns the value of attribute spec_href
259 260 261 |
# File 'rb/lib/selenium/webdriver/bidi/support/bidi_generate.rb', line 259 def spec_href @spec_href end |
#vendor_params ⇒ Object
Returns the value of attribute vendor_params
259 260 261 |
# File 'rb/lib/selenium/webdriver/bidi/support/bidi_generate.rb', line 259 def vendor_params @vendor_params end |
#wire_name ⇒ Object
Returns the value of attribute wire_name
259 260 261 |
# File 'rb/lib/selenium/webdriver/bidi/support/bidi_generate.rb', line 259 def wire_name @wire_name end |
Instance Method Details
#def_header(indent) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
261 262 263 264 |
# File 'rb/lib/selenium/webdriver/bidi/support/bidi_generate.rb', line 261 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) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
275 276 277 278 279 |
# File 'rb/lib/selenium/webdriver/bidi/support/bidi_generate.rb', line 275 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) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
293 294 295 296 297 |
# File 'rb/lib/selenium/webdriver/bidi/support/bidi_generate.rb', line 293 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) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
The extensible passthrough bag, carrying each set vendor field under its exact wire key.
282 283 284 285 286 |
# File 'rb/lib/selenium/webdriver/bidi/support/bidi_generate.rb', line 282 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) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
288 289 290 291 |
# File 'rb/lib/selenium/webdriver/bidi/support/bidi_generate.rb', line 288 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 ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
299 300 301 302 303 |
# File 'rb/lib/selenium/webdriver/bidi/support/bidi_generate.rb', line 299 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) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
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.
269 270 271 272 273 |
# File 'rb/lib/selenium/webdriver/bidi/support/bidi_generate.rb', line 269 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 |