Class: BiDiGenerate::TypeClass Private
- Inherits:
-
Struct
- Object
- Struct
- BiDiGenerate::TypeClass
- 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 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
418 419 420 |
# File 'rb/lib/selenium/webdriver/bidi/support/bidi_generate.rb', line 418 def discriminator @discriminator end |
#extensible ⇒ Object
Returns the value of attribute extensible
418 419 420 |
# File 'rb/lib/selenium/webdriver/bidi/support/bidi_generate.rb', line 418 def extensible @extensible end |
#fields ⇒ Object
Returns the value of attribute fields
418 419 420 |
# File 'rb/lib/selenium/webdriver/bidi/support/bidi_generate.rb', line 418 def fields @fields end |
#inbound ⇒ Object
Returns the value of attribute inbound
418 419 420 |
# File 'rb/lib/selenium/webdriver/bidi/support/bidi_generate.rb', line 418 def inbound @inbound end |
#label ⇒ Object
Returns the value of attribute label
418 419 420 |
# File 'rb/lib/selenium/webdriver/bidi/support/bidi_generate.rb', line 418 def label @label end |
#nested ⇒ Object
Returns the value of attribute nested
418 419 420 |
# File 'rb/lib/selenium/webdriver/bidi/support/bidi_generate.rb', line 418 def nested @nested end |
#outbound ⇒ Object
Returns the value of attribute outbound
418 419 420 |
# File 'rb/lib/selenium/webdriver/bidi/support/bidi_generate.rb', line 418 def outbound @outbound end |
#owner ⇒ Object
Returns the value of attribute owner
418 419 420 |
# File 'rb/lib/selenium/webdriver/bidi/support/bidi_generate.rb', line 418 def owner @owner end |
#ruby_name ⇒ Object
Returns the value of attribute ruby_name
418 419 420 |
# File 'rb/lib/selenium/webdriver/bidi/support/bidi_generate.rb', line 418 def ruby_name @ruby_name end |
#schema_name ⇒ Object
Returns the value of attribute schema_name
418 419 420 |
# File 'rb/lib/selenium/webdriver/bidi/support/bidi_generate.rb', line 418 def schema_name @schema_name end |
#spec_href ⇒ Object
Returns the value of attribute spec_href
418 419 420 |
# File 'rb/lib/selenium/webdriver/bidi/support/bidi_generate.rb', line 418 def spec_href @spec_href end |
#synthetic ⇒ Object
Returns the value of attribute synthetic
418 419 420 |
# File 'rb/lib/selenium/webdriver/bidi/support/bidi_generate.rb', line 418 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.
437 438 439 |
# File 'rb/lib/selenium/webdriver/bidi/support/bidi_generate.rb', line 437 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.
425 426 427 428 429 430 431 |
# File 'rb/lib/selenium/webdriver/bidi/support/bidi_generate.rb', line 425 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.
441 442 443 444 445 446 447 448 |
# File 'rb/lib/selenium/webdriver/bidi/support/bidi_generate.rb', line 441 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.
421 |
# File 'rb/lib/selenium/webdriver/bidi/support/bidi_generate.rb', line 421 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.
466 467 468 469 470 471 472 473 474 |
# File 'rb/lib/selenium/webdriver/bidi/support/bidi_generate.rb', line 466 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.
453 454 455 456 457 458 459 |
# File 'rb/lib/selenium/webdriver/bidi/support/bidi_generate.rb', line 453 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.
420 |
# File 'rb/lib/selenium/webdriver/bidi/support/bidi_generate.rb', line 420 def union? = false |