Module: BRS::Stream::WriterHelpers::ClassMethods

Defined in:
lib/brs/stream/writer_helpers.rb

Overview

– etc –

Instance Method Summary collapse

Instance Method Details

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



70
71
72
73
74
75
76
77
78
79
80
81
82
83
# File 'lib/brs/stream/writer_helpers.rb', line 70

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

  ::File.open file_path, "wb" do |io|
    writer = new io, *args

    begin
      yield writer
    ensure
      writer.close
    end
  end
end