Class: Archive::Writer

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

Instance Method Summary collapse

Instance Method Details

#new_entryObject

Creates a new Entry. An Entry holds the meta data for an item stored in an Archive, such as filetype, mode, owner, etc. It is typically populated by a call to copy_stat. It is written before the actual data.


129
130
131
132
133
134
135
136
# File 'lib/libarchive_rs.rb', line 129

def new_entry()
  entry = self.new_entry_helper
  if block_given?
    yield entry
  else
    return entry
  end
end

#write_data(data = nil) ⇒ Object

Write data to Archive. If a block is given, data returned from the block is stored until the block returns nil.


143
144
145
146
147
148
149
150
151
# File 'lib/libarchive_rs.rb', line 143

def write_data(data = nil)
  if block_given?
    while data = yield
      self.write_data_helper(data)
    end
  else
    self.write_data_helper(data)
  end
end