Class: Exerb::FileTable::Entry

Inherits:
Object
  • Object
show all
Defined in:
lib/exerb/file_table.rb

Overview

#

Defined Under Namespace

Classes: Header

Constant Summary collapse

FLAG_TYPE_RUBY_SCRIPT =
0x01
FLAG_TYPE_EXTENSION_LIBRARY =
0x02
FLAG_TYPE_DYNAMIC_LIBRARY =
0x03
FLAG_TYPE_RESOURCE_LIBRARY =
0x04
FLAG_TYPE_DATA_BINARY =
0x05
FLAG_TYPE_COMPILED_SCRIPT =
0x06
FLAG_NO_REPLACE_FUNCTION =
0x08

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id, data, flag) ⇒ Entry

Returns a new instance of Entry.



134
135
136
137
138
# File 'lib/exerb/file_table.rb', line 134

def initialize(id, data, flag)
  @id   = id
  @data = data
  @flag = flag
end

Instance Attribute Details

#dataObject (readonly)

Returns the value of attribute data.



140
141
142
# File 'lib/exerb/file_table.rb', line 140

def data
  @data
end

#flagObject (readonly)

Returns the value of attribute flag.



140
141
142
# File 'lib/exerb/file_table.rb', line 140

def flag
  @flag
end

#idObject (readonly)

Returns the value of attribute id.



140
141
142
# File 'lib/exerb/file_table.rb', line 140

def id
  @id
end

Instance Method Details

#pack_header(pool) ⇒ Object



142
143
144
145
146
147
148
149
150
# File 'lib/exerb/file_table.rb', line 142

def pack_header(pool)
  entry_header = Exerb::FileTable::Entry::Header.new
  entry_header.id             = @id
  entry_header.offset_of_file = pool.size
  entry_header.size_of_file   = @data.size
  entry_header.flag_of_file   = @flag

  return entry_header.pack
end

#pack_poolObject



152
153
154
# File 'lib/exerb/file_table.rb', line 152

def pack_pool
  return Exerb::Utility.alignment16(@data)
end