class Lignite::RbfObject

Part of an assembled RBF file

Constants

HEADER_SIZE

Attributes

body[R]

@return [ByteString] an already assembled body of the object

Public Class Methods

block(owner:, triggers:, body:) click to toggle source

@return [RbfObject] make a Block object

# File lib/lignite/rbf_object.rb, line 16
def self.block(owner:, triggers:, body:)
  new(owner: owner, triggers: triggers, local_bytes: 0, body: body)
end
new(owner:, triggers:, local_bytes:, body:) click to toggle source
# File lib/lignite/rbf_object.rb, line 23
def initialize(owner:, triggers:, local_bytes:, body:)
  @owner = owner
  @triggers = triggers
  @local_bytes = local_bytes
  @body = body
end
subcall(body:, local_bytes:) click to toggle source

@return [RbfObject] make a Subcall object

# File lib/lignite/rbf_object.rb, line 11
def self.subcall(body:, local_bytes:)
  new(owner: 0, triggers: 1, local_bytes: local_bytes, body: body)
end
vmthread(body:, local_bytes:) click to toggle source

@return [RbfObject] make a Vmthread object

# File lib/lignite/rbf_object.rb, line 6
def self.vmthread(body:, local_bytes:)
  new(owner: 0, triggers: 0, local_bytes: local_bytes, body: body)
end

Public Instance Methods

header(object_instruction_offset) click to toggle source
# File lib/lignite/rbf_object.rb, line 35
def header(object_instruction_offset)
  u32(object_instruction_offset) +
    u16(@owner) + u16(@triggers) + u32(@local_bytes)
end
size() click to toggle source
# File lib/lignite/rbf_object.rb, line 31
def size
  HEADER_SIZE + body.bytesize
end