Class: BiDiGenerate::TypeClass Private
- Inherits:
-
Struct
- Object
- Struct
- BiDiGenerate::TypeClass
- Defined in:
- 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 generated immutable value type (a Serialization::Record.define(...) class). discriminator is the baked variant tag wire:, value: or nil; schema_name/synthetic/owner/ nested drive owner-nesting (see nest_synthetic). spec_href links to the type's definition in the live spec (nil when the schema has none, e.g. a synthetic type).
Instance Attribute Summary collapse
-
#discriminator ⇒ Object
Returns the value of attribute discriminator.
-
#extensible ⇒ Object
Returns the value of attribute extensible.
-
#fields ⇒ Object
Returns the value of attribute fields.
-
#inbound ⇒ Object
Returns the value of attribute inbound.
-
#label ⇒ Object
Returns the value of attribute label.
-
#nested ⇒ Object
Returns the value of attribute nested.
-
#outbound ⇒ Object
Returns the value of attribute outbound.
-
#owner ⇒ Object
Returns the value of attribute owner.
-
#ruby_name ⇒ Object
Returns the value of attribute ruby_name.
-
#schema_name ⇒ Object
Returns the value of attribute schema_name.
-
#spec_href ⇒ Object
Returns the value of attribute spec_href.
-
#synthetic ⇒ Object
Returns the value of attribute synthetic.
Instance Method Summary collapse
-
#define_assignment(name, indent) ⇒ Object
private
Name = Serialization::Record.define(...)as one line when it fits within the line limit at the given indent, else wrapped one entry per line — so the emitted source stays inside RuboCop's length limit without a per-file exception. -
#define_entries(entry_indent) ⇒ Object
private
Keyword arguments for
Serialization::Record.define(...): the fixed discriminator member first, then the fields, then the extensible flag. - #discriminator_entry ⇒ Object private
- #nested_types ⇒ Object private
-
#rbs_new_args ⇒ Object
private
The keyword arguments
self.newaccepts: each constructable field with its value type, plus the optional extensions bag. -
#rbs_readers ⇒ Object
private
Every Data member gets a typed
attr_reader: the baked discriminator (typed to its const), each field (typed when required; UNSET-bearing optionals stay untyped), then the extensible passthrough. - #union? ⇒ Boolean private
Instance Attribute Details
#discriminator ⇒ Object
Returns the value of attribute discriminator
377 378 379 |
# File 'lib/selenium/webdriver/bidi/support/bidi_generate.rb', line 377 def discriminator @discriminator end |
#extensible ⇒ Object
Returns the value of attribute extensible
377 378 379 |
# File 'lib/selenium/webdriver/bidi/support/bidi_generate.rb', line 377 def extensible @extensible end |
#fields ⇒ Object
Returns the value of attribute fields
377 378 379 |
# File 'lib/selenium/webdriver/bidi/support/bidi_generate.rb', line 377 def fields @fields end |
#inbound ⇒ Object
Returns the value of attribute inbound
377 378 379 |
# File 'lib/selenium/webdriver/bidi/support/bidi_generate.rb', line 377 def inbound @inbound end |
#label ⇒ Object
Returns the value of attribute label
377 378 379 |
# File 'lib/selenium/webdriver/bidi/support/bidi_generate.rb', line 377 def label @label end |
#nested ⇒ Object
Returns the value of attribute nested
377 378 379 |
# File 'lib/selenium/webdriver/bidi/support/bidi_generate.rb', line 377 def nested @nested end |
#outbound ⇒ Object
Returns the value of attribute outbound
377 378 379 |
# File 'lib/selenium/webdriver/bidi/support/bidi_generate.rb', line 377 def outbound @outbound end |
#owner ⇒ Object
Returns the value of attribute owner
377 378 379 |
# File 'lib/selenium/webdriver/bidi/support/bidi_generate.rb', line 377 def owner @owner end |
#ruby_name ⇒ Object
Returns the value of attribute ruby_name
377 378 379 |
# File 'lib/selenium/webdriver/bidi/support/bidi_generate.rb', line 377 def ruby_name @ruby_name end |
#schema_name ⇒ Object
Returns the value of attribute schema_name
377 378 379 |
# File 'lib/selenium/webdriver/bidi/support/bidi_generate.rb', line 377 def schema_name @schema_name end |
#spec_href ⇒ Object
Returns the value of attribute spec_href
377 378 379 |
# File 'lib/selenium/webdriver/bidi/support/bidi_generate.rb', line 377 def spec_href @spec_href end |
#synthetic ⇒ Object
Returns the value of attribute synthetic
377 378 379 |
# File 'lib/selenium/webdriver/bidi/support/bidi_generate.rb', line 377 def synthetic @synthetic end |
Instance Method Details
#define_assignment(name, 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.
Name = Serialization::Record.define(...) as one line when it fits within the line limit at the
given indent, else wrapped one entry per line — so the emitted source stays inside
RuboCop's length limit without a per-file exception. Entries render at indent + 2, the
indent a long field hash wraps itself against.
396 397 398 |
# File 'lib/selenium/webdriver/bidi/support/bidi_generate.rb', line 396 def define_assignment(name, indent) BiDiGenerate.wrap_call("#{name} = Serialization::Record.define", define_entries(indent + 2), indent) end |
#define_entries(entry_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.
Keyword arguments for Serialization::Record.define(...): the fixed discriminator member
first, then the fields, then the extensible flag.
384 385 386 387 388 389 390 |
# File 'lib/selenium/webdriver/bidi/support/bidi_generate.rb', line 384 def define_entries(entry_indent) entries = [] entries << discriminator_entry if discriminator entries.concat(fields.map { |f| f.spec_entry(entry_indent) }) entries << 'extensible: true' if extensible entries end |
#discriminator_entry ⇒ 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.
400 401 402 403 404 405 406 407 |
# File 'lib/selenium/webdriver/bidi/support/bidi_generate.rb', line 400 def discriminator_entry literal = BiDiGenerate.ruby_literal(discriminator[:value]) if discriminator[:wire] == discriminator[:ruby_name].to_s "#{discriminator[:ruby_name]}: {fixed: #{literal}}" else "#{discriminator[:ruby_name]}: {wire_key: '#{discriminator[:wire]}', fixed: #{literal}}" end end |
#nested_types ⇒ 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.
380 |
# File 'lib/selenium/webdriver/bidi/support/bidi_generate.rb', line 380 def nested_types = nested || [] |
#rbs_new_args ⇒ 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 keyword arguments self.new accepts: each constructable field with its value
type, plus the optional extensions bag. The fixed discriminator is baked, so its
value is ignored — but the lenient **kwargs constructor still accepts it (and a
command method passes it through), so it is advertised as an optional keyword typed
to its const.
425 426 427 428 429 430 431 432 433 |
# File 'lib/selenium/webdriver/bidi/support/bidi_generate.rb', line 425 def rbs_new_args parts = [] parts << "?#{discriminator[:ruby_name]}: #{discriminator[:rbs]}" if discriminator parts.concat(fields.map(&:rbs_arg)) # Match the reader type and the extensible Record impl (which calls `merge!`/`empty?` on it), # so a type checker rejects a non-Hash before it crashes at serialization. parts << '?extensions: Hash[String, untyped]' if extensible parts.join(', ') end |
#rbs_readers ⇒ 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.
Every Data member gets a typed attr_reader: the baked discriminator (typed to its
const), each field (typed when required; UNSET-bearing optionals stay untyped), then
the extensible passthrough.
412 413 414 415 416 417 418 |
# File 'lib/selenium/webdriver/bidi/support/bidi_generate.rb', line 412 def rbs_readers readers = [] readers << "#{discriminator[:ruby_name]}: #{discriminator[:rbs]}" if discriminator readers.concat(fields.map(&:rbs_reader)) readers << 'extensions: Hash[String, untyped]' if extensible readers end |
#union? ⇒ Boolean
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.
379 |
# File 'lib/selenium/webdriver/bidi/support/bidi_generate.rb', line 379 def union? = false |