Module: Bulldog::Stream

Defined in:
lib/bulldog/stream.rb

Overview

Gives IO, StringIO, Tempfile, and SavedFile a common interface.

In particular, this takes care of writing it to a file so external programs may be called on it, while keeping the number of file writes to a minimum.

Defined Under Namespace

Classes: Base, ForFile, ForIO, ForMissingFile, ForSavedFile, ForStringIO, ForTempfile

Class Method Summary collapse

Class Method Details

.new(object) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/bulldog/stream.rb', line 10

def self.new(object)
  klass =
    case object
    when ::Tempfile
      ForTempfile
    when File
      ForFile
    when SavedFile
      ForSavedFile
    when MissingFile
      ForMissingFile
    when StringIO
      ForStringIO
    when IO
      ForIO
    end
  klass.new(object)
end