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).
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.
-
#label ⇒ Object
Returns the value of attribute label.
-
#nested ⇒ Object
Returns the value of attribute nested.
-
#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.
-
#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
274 275 276 |
# File 'lib/selenium/webdriver/bidi/support/bidi_generate.rb', line 274 def discriminator @discriminator end |
#extensible ⇒ Object
Returns the value of attribute extensible
274 275 276 |
# File 'lib/selenium/webdriver/bidi/support/bidi_generate.rb', line 274 def extensible @extensible end |
#fields ⇒ Object
Returns the value of attribute fields
274 275 276 |
# File 'lib/selenium/webdriver/bidi/support/bidi_generate.rb', line 274 def fields @fields end |
#label ⇒ Object
Returns the value of attribute label
274 275 276 |
# File 'lib/selenium/webdriver/bidi/support/bidi_generate.rb', line 274 def label @label end |
#nested ⇒ Object
Returns the value of attribute nested
274 275 276 |
# File 'lib/selenium/webdriver/bidi/support/bidi_generate.rb', line 274 def nested @nested end |
#owner ⇒ Object
Returns the value of attribute owner
274 275 276 |
# File 'lib/selenium/webdriver/bidi/support/bidi_generate.rb', line 274 def owner @owner end |
#ruby_name ⇒ Object
Returns the value of attribute ruby_name
274 275 276 |
# File 'lib/selenium/webdriver/bidi/support/bidi_generate.rb', line 274 def ruby_name @ruby_name end |
#schema_name ⇒ Object
Returns the value of attribute schema_name
274 275 276 |
# File 'lib/selenium/webdriver/bidi/support/bidi_generate.rb', line 274 def schema_name @schema_name end |
#synthetic ⇒ Object
Returns the value of attribute synthetic
274 275 276 |
# File 'lib/selenium/webdriver/bidi/support/bidi_generate.rb', line 274 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.
293 294 295 |
# File 'lib/selenium/webdriver/bidi/support/bidi_generate.rb', line 293 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.
281 282 283 284 285 286 287 |
# File 'lib/selenium/webdriver/bidi/support/bidi_generate.rb', line 281 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.
297 298 299 300 301 302 303 304 |
# File 'lib/selenium/webdriver/bidi/support/bidi_generate.rb', line 297 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.
277 |
# File 'lib/selenium/webdriver/bidi/support/bidi_generate.rb', line 277 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.
322 323 324 325 326 327 328 |
# File 'lib/selenium/webdriver/bidi/support/bidi_generate.rb', line 322 def rbs_new_args parts = [] parts << "?#{discriminator[:ruby_name]}: #{discriminator[:rbs]}" if discriminator parts.concat(fields.map(&:rbs_arg)) parts << '?extensions: 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.
309 310 311 312 313 314 315 |
# File 'lib/selenium/webdriver/bidi/support/bidi_generate.rb', line 309 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.
276 |
# File 'lib/selenium/webdriver/bidi/support/bidi_generate.rb', line 276 def union? = false |