Method: Zip::StreamableStream#get_input_stream

Defined in:
lib/zip/streamable_stream.rb

#get_input_streamObject



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/zip/streamable_stream.rb', line 23

def get_input_stream
  unless @temp_file.closed?
    raise StandardError, "cannot open entry for reading while its open for writing - #{name}"
  end

  @temp_file.open # reopens tempfile from top
  @temp_file.binmode
  if block_given?
    begin
      yield(@temp_file)
    ensure
      @temp_file.close
    end
  else
    @temp_file
  end
end