123456789_123456789_123456789_123456789_123456789_

Class: BiDiGenerate::Command 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

params_class is the Parameters class the named args construct (nil for a no-arg command); union_params picks its variant via .build rather than .new. result_ref is the Protocol-relative result class path, or nil to return the raw hash.

Instance Attribute Summary

  • #method_name rw Internal use only

    params_class is the Parameters class the named args construct (nil for a no-arg command); union_params picks its variant via .build rather than .new.

  • #params rw Internal use only

    params_class is the Parameters class the named args construct (nil for a no-arg command); union_params picks its variant via .build rather than .new.

  • #params_class rw Internal use only

    params_class is the Parameters class the named args construct (nil for a no-arg command); union_params picks its variant via .build rather than .new.

  • #result_ref rw Internal use only

    params_class is the Parameters class the named args construct (nil for a no-arg command); union_params picks its variant via .build rather than .new.

  • #spec_href rw Internal use only

    params_class is the Parameters class the named args construct (nil for a no-arg command); union_params picks its variant via .build rather than .new.

  • #union_params rw Internal use only

    params_class is the Parameters class the named args construct (nil for a no-arg command); union_params picks its variant via .build rather than .new.

  • #wire_name rw Internal use only

    params_class is the Parameters class the named args construct (nil for a no-arg command); union_params picks its variant via .build rather than .new.

Instance Method Summary

Instance Attribute Details

#method_name (rw)

params_class is the Parameters class the named args construct (nil for a no-arg command); union_params picks its variant via .build rather than .new. result_ref is the Protocol-relative result class path, or nil to return the raw hash.

[ GitHub ]

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

Command = Struct.new(:wire_name, :method_name, :params, :result_ref, :params_class,
:union_params, :spec_href, keyword_init: true)

#params (rw)

params_class is the Parameters class the named args construct (nil for a no-arg command); union_params picks its variant via .build rather than .new. result_ref is the Protocol-relative result class path, or nil to return the raw hash.

[ GitHub ]

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

Command = Struct.new(:wire_name, :method_name, :params, :result_ref, :params_class,
:union_params, :spec_href, keyword_init: true)

#params_class (rw)

params_class is the Parameters class the named args construct (nil for a no-arg command); union_params picks its variant via .build rather than .new. result_ref is the Protocol-relative result class path, or nil to return the raw hash.

[ GitHub ]

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

Command = Struct.new(:wire_name, :method_name, :params, :result_ref, :params_class,
:union_params, :spec_href, keyword_init: true)

#result_ref (rw)

params_class is the Parameters class the named args construct (nil for a no-arg command); union_params picks its variant via .build rather than .new. result_ref is the Protocol-relative result class path, or nil to return the raw hash.

[ GitHub ]

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

Command = Struct.new(:wire_name, :method_name, :params, :result_ref, :params_class,
:union_params, :spec_href, keyword_init: true)

#spec_href (rw)

params_class is the Parameters class the named args construct (nil for a no-arg command); union_params picks its variant via .build rather than .new. result_ref is the Protocol-relative result class path, or nil to return the raw hash.

[ GitHub ]

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

Command = Struct.new(:wire_name, :method_name, :params, :result_ref, :params_class,
:union_params, :spec_href, keyword_init: true)

#union_params (rw)

params_class is the Parameters class the named args construct (nil for a no-arg command); union_params picks its variant via .build rather than .new. result_ref is the Protocol-relative result class path, or nil to return the raw hash.

[ GitHub ]

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

Command = Struct.new(:wire_name, :method_name, :params, :result_ref, :params_class,
:union_params, :spec_href, keyword_init: true)

#wire_name (rw)

params_class is the Parameters class the named args construct (nil for a no-arg command); union_params picks its variant via .build rather than .new. result_ref is the Protocol-relative result class path, or nil to return the raw hash.

[ GitHub ]

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

Command = Struct.new(:wire_name, :method_name, :params, :result_ref, :params_class,
:union_params, :spec_href, keyword_init: true)

Instance Method Details

#def_header(indent)

def name or def name(...) — wrapped one argument per line when the signature would exceed the line limit.

[ GitHub ]

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

def def_header(indent)
  return "def #{method_name}" if params.empty?

  BiDiGenerate.wrap_call("def #{method_name}", required_params.map(&:sig_part) + optional_params.map(&:sig_part),
                         indent)
end

#enum_checks(indent)

[ GitHub ]

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

def enum_checks(indent) = params.filter_map { |p| p.enum_check(indent) }

#execute_call(indent)

@transport.execute(cmd:[, params: params][, result:]). The result type is referenced directly (resolved lazily in the method body, and unambiguous within Protocol). Params, when present, are the #params local built above.

[ GitHub ]

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

def execute_call(indent)
  args = ["cmd: '#{wire_name}'"]
  args << 'params: params' unless params.empty?
  args << "result: #{result_ref}" if result_ref
  BiDiGenerate.wrap_call('execute', args, indent)
end

#optional_params

[ GitHub ]

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

def optional_params = params.reject(&:required)

#params_assignment(indent)

The params = … line built before the execute call, or nil for a no-arg command. A record builds its Parameters object and a union dispatches via .build (whose typed as_json emits explicit null where a flat hash through Transport could not). Wrapped one entry per line when long, so it (and the short execute call) stay within the limit.

[ GitHub ]

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

def params_assignment(indent)
  return nil if params.empty?

  kwargs = params.map { |p| "#{p.ruby_name}: #{p.ruby_name}" }
  BiDiGenerate.wrap_call("params = #{params_class}.#{union_params ? 'build' : 'new'}", kwargs, indent)
end

#rbs_params

[ GitHub ]

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

def rbs_params
  (required_params.map(&:rbs_part) + optional_params.map(&:rbs_part)).join(', ')
end

#rbs_return

[ GitHub ]

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

def rbs_return
  result_ref ? "::Selenium::WebDriver::BiDi::Protocol::#{result_ref}" : 'untyped'
end

#rbs_signature

The RBS method signature (params) -> return — the return is the typed result class when the command parses one, else untyped.

[ GitHub ]

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

def rbs_signature
  "(#{rbs_params}) -> #{rbs_return}"
end

#required_params

[ GitHub ]

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

def required_params = params.select(&:required)