def split_file_token token
start_pos, filesize, filename = token.split(':', 3)
- [start_pos.to_i, filesize.to_i, filename]
+ if filename.nil?
+ raise ArgumentError.new "Invalid file token '#{token}'"
+ end
+ [start_pos.to_i, filesize.to_i, unescape(filename)]
end
def each_file_spec
- return to_enum(__method__, speclist) unless block_given?
+ return to_enum(__method__) unless block_given?
@text.each_line do |line|
stream_name = nil
in_file_tokens = false
seen_files.size
end
+ def files_size
+ # Return the total size of all files in this manifest.
+ files.reduce(0) { |total, (_, _, size)| total + size }
+ end
+
def exact_file_count?(want_count)
files_count(want_count + 1) == want_count
end