Method: Minitar::Input#initialize
- Defined in:
- lib/minitar/input.rb
#initialize(input) ⇒ Input
Creates a new Input object. If input is a stream object that responds to #read, then it will simply be wrapped. Otherwise, one will be created and opened using Kernel#open. When Input#close is called, the stream object wrapped will be closed.
An exception will be raised if the stream that is wrapped does not support rewinding.
:call-seq:
Minitar::Input.new(io) -> input
Minitar::Input.new(path) -> input
83 84 85 86 87 88 89 90 91 92 93 94 |
# File 'lib/minitar/input.rb', line 83 def initialize(input) @io = if input.respond_to?(:read) input else ::Kernel.open(input, "rb") end raise Minitar::NonSeekableStream unless Minitar.seekable?(@io, :rewind) @tar = Reader.new(@io) end |