Module: ZSTDS::Stream::ReaderHelpers::ClassMethods

Defined in:
lib/zstds/stream/reader_helpers.rb

Overview

– etc –

Instance Method Summary collapse

Instance Method Details

#open(file_path, *args, &block) ⇒ Object



173
174
175
176
177
178
179
180
181
182
183
184
185
186
# File 'lib/zstds/stream/reader_helpers.rb', line 173

def open(file_path, *args, &block)
  Validation.validate_string file_path
  Validation.validate_proc block

  ::File.open file_path, "rb" do |io|
    reader = new io, *args

    begin
      yield reader
    ensure
      reader.close
    end
  end
end