Class: BiDiGenerate::FieldIR Private
- Inherits:
-
Struct
- Object
- Struct
- BiDiGenerate::FieldIR
- 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.
ref is the Protocol-relative class path for a nested structured field (nil
for a scalar/opaque field); list wraps it in an array. wire_key is the exact
JSON payload key (the schema's wire name, baked verbatim).
Instance Attribute Summary collapse
-
#const ⇒ Object
Returns the value of attribute const.
-
#enum ⇒ Object
Returns the value of attribute enum.
-
#list ⇒ Object
Returns the value of attribute list.
-
#map_of ⇒ Object
Returns the value of attribute map_of.
-
#nullable ⇒ Object
Returns the value of attribute nullable.
-
#primitive ⇒ Object
Returns the value of attribute primitive.
-
#rbs ⇒ Object
Returns the value of attribute rbs.
-
#ref ⇒ Object
Returns the value of attribute ref.
-
#required ⇒ Object
Returns the value of attribute required.
-
#ruby_name ⇒ Object
Returns the value of attribute ruby_name.
-
#scalar ⇒ Object
Returns the value of attribute scalar.
-
#wire_key ⇒ Object
Returns the value of attribute wire_key.
Instance Method Summary collapse
-
#rbs_arg ⇒ Object
private
The
self.newkeyword for this field — a user-supplied input carrying the field's value type. -
#rbs_reader ⇒ Object
private
The
attr_readertype. -
#scalar_literal ⇒ Object
private
The
scalarprimitive(s) a bare non-object wire value must match at a scalar-tolerant union position: a single primitive string, or an array when the union's scalar arms differ. -
#spec_entry(indent = 0) ⇒ Object
private
A
Serialization::Record.definespec entry:name: 'jsonKey'shorthand, orname: {wire_key:, …}when the field carries JSON facts beyond its name. -
#type_facts ⇒ Object
private
The facts describing the value's type and shape: what the runtime reads it as and checks it against.
-
#value_facts ⇒ Object
private
The JSON facts beyond the field's name, in the order Record.define reads them.
Instance Attribute Details
#const ⇒ Object
Returns the value of attribute const
357 358 359 |
# File 'rb/lib/selenium/webdriver/bidi/support/bidi_generate.rb', line 357 def const @const end |
#enum ⇒ Object
Returns the value of attribute enum
357 358 359 |
# File 'rb/lib/selenium/webdriver/bidi/support/bidi_generate.rb', line 357 def enum @enum end |
#list ⇒ Object
Returns the value of attribute list
357 358 359 |
# File 'rb/lib/selenium/webdriver/bidi/support/bidi_generate.rb', line 357 def list @list end |
#map_of ⇒ Object
Returns the value of attribute map_of
357 358 359 |
# File 'rb/lib/selenium/webdriver/bidi/support/bidi_generate.rb', line 357 def map_of @map_of end |
#nullable ⇒ Object
Returns the value of attribute nullable
357 358 359 |
# File 'rb/lib/selenium/webdriver/bidi/support/bidi_generate.rb', line 357 def nullable @nullable end |
#primitive ⇒ Object
Returns the value of attribute primitive
357 358 359 |
# File 'rb/lib/selenium/webdriver/bidi/support/bidi_generate.rb', line 357 def primitive @primitive end |
#rbs ⇒ Object
Returns the value of attribute rbs
357 358 359 |
# File 'rb/lib/selenium/webdriver/bidi/support/bidi_generate.rb', line 357 def rbs @rbs end |
#ref ⇒ Object
Returns the value of attribute ref
357 358 359 |
# File 'rb/lib/selenium/webdriver/bidi/support/bidi_generate.rb', line 357 def ref @ref end |
#required ⇒ Object
Returns the value of attribute required
357 358 359 |
# File 'rb/lib/selenium/webdriver/bidi/support/bidi_generate.rb', line 357 def required @required end |
#ruby_name ⇒ Object
Returns the value of attribute ruby_name
357 358 359 |
# File 'rb/lib/selenium/webdriver/bidi/support/bidi_generate.rb', line 357 def ruby_name @ruby_name end |
#scalar ⇒ Object
Returns the value of attribute scalar
357 358 359 |
# File 'rb/lib/selenium/webdriver/bidi/support/bidi_generate.rb', line 357 def scalar @scalar end |
#wire_key ⇒ Object
Returns the value of attribute wire_key
357 358 359 |
# File 'rb/lib/selenium/webdriver/bidi/support/bidi_generate.rb', line 357 def wire_key @wire_key end |
Instance Method Details
#rbs_arg ⇒ 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 self.new keyword for this field — a user-supplied input carrying the field's
value type. The ? prefix marks the field omittable; its value type already carries
the schema's nullability, so nil is admitted only for a nullable field.
403 404 405 |
# File 'rb/lib/selenium/webdriver/bidi/support/bidi_generate.rb', line 403 def rbs_arg required ? "#{ruby_name}: #{rbs}" : "?#{ruby_name}: #{rbs}" end |
#rbs_reader ⇒ 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 attr_reader type. A present value is rbs; an omitted optional reads back
the UNSET sentinel, which a value type can't capture, so optionals stay untyped.
409 410 411 |
# File 'rb/lib/selenium/webdriver/bidi/support/bidi_generate.rb', line 409 def rbs_reader "#{ruby_name}: #{required ? rbs : 'untyped'}" end |
#scalar_literal ⇒ 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 scalar primitive(s) a bare non-object wire value must match at a scalar-tolerant
union position: a single primitive string, or an array when the union's scalar arms differ.
396 397 398 |
# File 'rb/lib/selenium/webdriver/bidi/support/bidi_generate.rb', line 396 def scalar_literal scalar.is_a?(::Array) ? "[#{scalar.map { |s| "'#{s}'" }.join(', ')}]" : "'#{scalar}'" end |
#spec_entry(indent = 0) ⇒ 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.
A Serialization::Record.define spec entry: name: 'jsonKey' shorthand, or
name: {wire_key:, …} when the field carries JSON facts beyond its name.
enum carries the allowed-values constant path, validated at construction.
362 363 364 365 366 367 368 |
# File 'rb/lib/selenium/webdriver/bidi/support/bidi_generate.rb', line 362 def spec_entry(indent = 0) = value_facts return "#{ruby_name}: '#{wire_key}'" if .empty? .unshift("wire_key: '#{wire_key}'") BiDiGenerate.wrap_call("#{ruby_name}: ", , indent, open: '{', close: '}') end |
#type_facts ⇒ 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 facts describing the value's type and shape: what the runtime reads it as and checks
it against. map_of is the value primitive of a string-keyed map ({*text => text}).
383 384 385 386 387 388 389 390 391 392 |
# File 'rb/lib/selenium/webdriver/bidi/support/bidi_generate.rb', line 383 def type_facts facts = [] facts << "ref: '#{ref}'" if ref facts << 'list: true' if list facts << "scalar: #{scalar_literal}" if scalar facts << "enum: '#{enum}'" if enum facts << "primitive: '#{primitive}'" if primitive facts << "map: '#{map_of}'" if map_of facts end |
#value_facts ⇒ 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 JSON facts beyond the field's name, in the order Record.define reads them. A
nullable const (literal / null) carries const: so the runtime rejects a value that
is neither the literal nor null; const.nil? means the field has no const at all.
373 374 375 376 377 378 379 |
# File 'rb/lib/selenium/webdriver/bidi/support/bidi_generate.rb', line 373 def value_facts facts = [] facts << 'required: false' unless required facts << 'nullable: true' if nullable facts << "const: #{BiDiGenerate.ruby_literal(const)}" unless const.nil? facts + type_facts end |