Class: Pack::Writer

Inherits:
Object
  • Object
show all
Defined in:
lib/pack/writer.rb

Instance Method Summary collapse

Constructor Details

#initialize(output, database, options = {}) ⇒ Writer

Returns a new instance of Writer.



11
12
13
14
15
16
17
18
19
20
# File 'lib/pack/writer.rb', line 11

def initialize(output, database, options = {})
  @output   = output
  @database = database
  @digest   = Digest::SHA1.new
  @offset   = 0

  @compression = options.fetch(:compression, Zlib::DEFAULT_COMPRESSION)
  @allow_ofs   = options[:allow_ofs]
  @progress    = options[:progress]
end

Instance Method Details

#write_objects(rev_list) ⇒ Object



22
23
24
25
26
27
28
# File 'lib/pack/writer.rb', line 22

def write_objects(rev_list)
  prepare_pack_list(rev_list)
  compress_objects
  write_header
  write_entries
  @output.write(@digest.digest)
end