Class: HMap::MapFile
- Inherits:
-
Object
- Object
- HMap::MapFile
- Defined in:
- lib/hmap/hmap/mapfile.rb
Overview
hmap file writer
Instance Method Summary collapse
-
#initialize(strings, buckets, entries) ⇒ MapFile
constructor
private
A new instance of MapFile.
-
#serialize ⇒ String
The serialized fields of the mafile.
-
#write(filepath, contents = nil) ⇒ void
Write all mafile data to the given filename.
Constructor Details
#initialize(strings, buckets, entries) ⇒ 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.
7 8 9 |
# File 'lib/hmap/hmap/mapfile.rb', line 7 def initialize(strings, buckets, entries) @map_data = HMapData.new(strings, buckets, entries) end |
Instance Method Details
#serialize ⇒ String
Returns the serialized fields of the mafile.
12 13 14 |
# File 'lib/hmap/hmap/mapfile.rb', line 12 def serialize @map_data.serialize end |
#write(filepath, contents = nil) ⇒ void
This method returns an undefined value.
Write all mafile data to the given filename.
19 20 21 22 |
# File 'lib/hmap/hmap/mapfile.rb', line 19 def write(filepath, contents = nil) contents = serialize if contents.nil? Utils.update_changed_file(filepath, contents) end |