Class: IOStreams::File::Writer

Inherits:
Object
  • Object
show all
Defined in:
lib/io_streams/file/writer.rb

Class Method Summary collapse

Class Method Details

.open(file_name_or_io, _ = nil, &block) ⇒ Object

Write to a file or stream



5
6
7
8
9
10
11
# File 'lib/io_streams/file/writer.rb', line 5

def self.open(file_name_or_io, _=nil, &block)
  unless IOStreams.writer_stream?(file_name_or_io)
    ::File.open(file_name_or_io, 'wb', &block)
  else
    block.call(file_name_or_io)
  end
end