Class: NoopBackup::Tee::Sink

Inherits:
Struct
  • Object
show all
Defined in:
lib/noop_backup/tee.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#storeObject

Returns the value of attribute store

Returns:

  • (Object)

    the current value of store



3
4
5
# File 'lib/noop_backup/tee.rb', line 3

def store
  @store
end

#threadObject

Returns the value of attribute thread

Returns:

  • (Object)

    the current value of thread



3
4
5
# File 'lib/noop_backup/tee.rb', line 3

def thread
  @thread
end

#writerObject

Returns the value of attribute writer

Returns:

  • (Object)

    the current value of writer



3
4
5
# File 'lib/noop_backup/tee.rb', line 3

def writer
  @writer
end

Instance Method Details

#closeObject



14
15
16
# File 'lib/noop_backup/tee.rb', line 14

def close
  writer.close
end

#collectObject



18
19
20
21
22
# File 'lib/noop_backup/tee.rb', line 18

def collect
  thread.value
rescue
  nil
end

#write(chunk) ⇒ Object



4
5
6
7
8
9
10
11
12
# File 'lib/noop_backup/tee.rb', line 4

def write(chunk)
  return if @error

  writer.write(chunk)
rescue Errno::EPIPE, IOError => e
  @error = e

  close unless writer.closed?
end