Class: HMap::HMapData

Inherits:
Object
  • Object
show all
Defined in:
lib/hmap/hmap/hmap_struct.rb

Overview

HMap blobs.

Instance Method Summary collapse

Constructor Details

#initialize(strings, buckets, entries) ⇒ HMapData

Returns a new instance of HMapData.



156
157
158
159
160
161
162
163
# File 'lib/hmap/hmap/hmap_struct.rb', line 156

def initialize(strings, buckets, entries)
  super()
  return if strings.nil? || buckets.empty?

  @buckets = buckets
  @strings = strings
  @header = populate_hmap_header(buckets.count, entries)
end

Instance Method Details

#serializeString

Returns the serialized fields of the mafile.

Returns:

  • (String)

    the serialized fields of the mafile



166
167
168
169
170
# File 'lib/hmap/hmap/hmap_struct.rb', line 166

def serialize
  return EMPTY_HMAP if @strings.nil?

  @header.serialize + @buckets.join + @strings
end