Class: Schema::Field
Defined Under Namespace
Classes: GroupGroup, GroupOrdinal, GroupSlot, List, Which
Constant Summary
collapse
- DEFAULT_NAME =
nil
- DEFAULT_CODE_ORDER =
0
- DEFAULT_DISCRIMINANT_VALUE =
65535
- NO_DISCRIMINANT =
65535
Instance Method Summary
collapse
decode_pointer, from_pointer, #initialize
Constructor Details
This class inherits a constructor from Capnp::Struct
Instance Method Details
#code_order ⇒ Object
329
|
# File 'lib/capnp/generator/schema.capnp.rb', line 329
def code_order = read_u16(0, 0)
|
#discriminant_value ⇒ Object
334
|
# File 'lib/capnp/generator/schema.capnp.rb', line 334
def discriminant_value = read_u16(2, 65535)
|
#group ⇒ Object
362
|
# File 'lib/capnp/generator/schema.capnp.rb', line 362
def group = GroupGroup.new(@data, @data_size, @pointers, @pointers_size)
|
#is_group? ⇒ Boolean
376
|
# File 'lib/capnp/generator/schema.capnp.rb', line 376
def is_group? = which? == Which::Group
|
#is_slot? ⇒ Boolean
360
|
# File 'lib/capnp/generator/schema.capnp.rb', line 360
def is_slot? = which? == Which::Slot
|
#ordinal ⇒ Object
378
|
# File 'lib/capnp/generator/schema.capnp.rb', line 378
def ordinal = GroupOrdinal.new(@data, @data_size, @pointers, @pointers_size)
|
#slot ⇒ Object
336
|
# File 'lib/capnp/generator/schema.capnp.rb', line 336
def slot = GroupSlot.new(@data, @data_size, @pointers, @pointers_size)
|
#to_obj ⇒ Object
444
445
446
447
448
449
450
451
452
453
454
455
456
|
# File 'lib/capnp/generator/schema.capnp.rb', line 444
def to_obj
res = {}
res["name"] = name&.to_obj
res["code_order"] = code_order
res["annotations"] = annotations&.to_obj
res["discriminant_value"] = discriminant_value
res["ordinal"] = ordinal.to_obj
case which?
when Which::Slot then res["slot"] = slot.to_obj
when Which::Group then res["group"] = group.to_obj
end
res
end
|
#which? ⇒ Boolean
426
|
# File 'lib/capnp/generator/schema.capnp.rb', line 426
def which? = Which.from_integer(read_u16(8, 0))
|