Class: HMap::MapFile

Inherits:
Object
  • Object
show all
Defined in:
lib/cocoapods-hmap/mapfile.rb

Overview

hmap file writer

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(strings, buckets) ⇒ MapFile

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.

Returns a new instance of MapFile.



14
15
16
17
18
# File 'lib/cocoapods-hmap/mapfile.rb', line 14

def initialize(strings, buckets)
  @string_table = strings
  @buckets = buckets
  @map_data = HMapData.new(buckets)
end

Instance Attribute Details

#bucketsArray<HMap::HMapBucketStr> (readonly)

Note:

bucktes are provided in order of ascending offset.

Returns an array of the file’s bucktes.

Returns:



11
12
13
# File 'lib/cocoapods-hmap/mapfile.rb', line 11

def buckets
  @buckets
end

#string_tableObject (readonly)

Returns mapfile string_table.

Returns:

  • mapfile string_table



7
8
9
# File 'lib/cocoapods-hmap/mapfile.rb', line 7

def string_table
  @string_table
end

Instance Method Details

#serializeString

Returns the serialized fields of the mafile.

Returns:

  • (String)

    the serialized fields of the mafile



21
22
23
# File 'lib/cocoapods-hmap/mapfile.rb', line 21

def serialize
  @map_data.serialize + @string_table
end

#write(path) ⇒ void

This method returns an undefined value.

Write all mafile data to the given filename.

Parameters:

  • filename (String)

    the file to write to



28
29
30
31
# File 'lib/cocoapods-hmap/mapfile.rb', line 28

def write(path)
  contents = serialize
  Utils.update_changed_file(path, contents)
end