Class: BiDiGenerate::FieldIR Private

Inherits:
Struct
  • Object
show all
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.

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

Instance Method Summary collapse

Instance Attribute Details

#constObject

Returns the value of attribute const

Returns:

  • (Object)

    the current value of const



333
334
335
# File 'lib/selenium/webdriver/bidi/support/bidi_generate.rb', line 333

def const
  @const
end

#enumObject

Returns the value of attribute enum

Returns:

  • (Object)

    the current value of enum



333
334
335
# File 'lib/selenium/webdriver/bidi/support/bidi_generate.rb', line 333

def enum
  @enum
end

#listObject

Returns the value of attribute list

Returns:

  • (Object)

    the current value of list



333
334
335
# File 'lib/selenium/webdriver/bidi/support/bidi_generate.rb', line 333

def list
  @list
end

#nullableObject

Returns the value of attribute nullable

Returns:

  • (Object)

    the current value of nullable



333
334
335
# File 'lib/selenium/webdriver/bidi/support/bidi_generate.rb', line 333

def nullable
  @nullable
end

#primitiveObject

Returns the value of attribute primitive

Returns:

  • (Object)

    the current value of primitive



333
334
335
# File 'lib/selenium/webdriver/bidi/support/bidi_generate.rb', line 333

def primitive
  @primitive
end

#rbsObject

Returns the value of attribute rbs

Returns:

  • (Object)

    the current value of rbs



333
334
335
# File 'lib/selenium/webdriver/bidi/support/bidi_generate.rb', line 333

def rbs
  @rbs
end

#refObject

Returns the value of attribute ref

Returns:

  • (Object)

    the current value of ref



333
334
335
# File 'lib/selenium/webdriver/bidi/support/bidi_generate.rb', line 333

def ref
  @ref
end

#requiredObject

Returns the value of attribute required

Returns:

  • (Object)

    the current value of required



333
334
335
# File 'lib/selenium/webdriver/bidi/support/bidi_generate.rb', line 333

def required
  @required
end

#ruby_nameObject

Returns the value of attribute ruby_name

Returns:

  • (Object)

    the current value of ruby_name



333
334
335
# File 'lib/selenium/webdriver/bidi/support/bidi_generate.rb', line 333

def ruby_name
  @ruby_name
end

#scalarObject

Returns the value of attribute scalar

Returns:

  • (Object)

    the current value of scalar



333
334
335
# File 'lib/selenium/webdriver/bidi/support/bidi_generate.rb', line 333

def scalar
  @scalar
end

#wire_keyObject

Returns the value of attribute wire_key

Returns:

  • (Object)

    the current value of wire_key



333
334
335
# File 'lib/selenium/webdriver/bidi/support/bidi_generate.rb', line 333

def wire_key
  @wire_key
end

Instance Method Details

#rbs_argObject

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.



371
372
373
# File 'lib/selenium/webdriver/bidi/support/bidi_generate.rb', line 371

def rbs_arg
  required ? "#{ruby_name}: #{rbs}" : "?#{ruby_name}: #{rbs}"
end

#rbs_readerObject

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.



377
378
379
# File 'lib/selenium/webdriver/bidi/support/bidi_generate.rb', line 377

def rbs_reader
  "#{ruby_name}: #{required ? rbs : 'untyped'}"
end

#scalar_literalObject

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.



364
365
366
# File 'lib/selenium/webdriver/bidi/support/bidi_generate.rb', line 364

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.



338
339
340
341
342
343
344
# File 'lib/selenium/webdriver/bidi/support/bidi_generate.rb', line 338

def spec_entry(indent = 0)
  meta = value_facts
  return "#{ruby_name}: '#{wire_key}'" if meta.empty?

  meta.unshift("wire_key: '#{wire_key}'")
  BiDiGenerate.wrap_call("#{ruby_name}: ", meta, indent, open: '{', close: '}')
end

#value_factsObject

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.



349
350
351
352
353
354
355
356
357
358
359
360
# File 'lib/selenium/webdriver/bidi/support/bidi_generate.rb', line 349

def value_facts
  facts = []
  facts << 'required: false' unless required
  facts << 'nullable: true' if nullable
  facts << "const: #{BiDiGenerate.ruby_literal(const)}" unless const.nil?
  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
end