Class: Capistrano::OutputCatcher::TeeIO

Inherits:
Object
  • Object
show all
Defined in:
lib/capistrano/ext/output_catcher.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(sniffed_io_stream, listening_io_stream) ⇒ TeeIO

Returns a new instance of TeeIO.



17
18
19
20
# File 'lib/capistrano/ext/output_catcher.rb', line 17

def initialize(sniffed_io_stream, listening_io_stream)
  self.sniffed_io_stream = sniffed_io_stream
  self.listening_io_stream = listening_io_stream
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method_name, *args, &block) ⇒ Object



28
29
30
# File 'lib/capistrano/ext/output_catcher.rb', line 28

def method_missing(method_name, *args, &block)
  distribute(method_name, *args, &block)
end

Instance Attribute Details

#listening_io_streamObject

Returns the value of attribute listening_io_stream.



15
16
17
# File 'lib/capistrano/ext/output_catcher.rb', line 15

def listening_io_stream
  @listening_io_stream
end

#sniffed_io_streamObject

Returns the value of attribute sniffed_io_stream.



15
16
17
# File 'lib/capistrano/ext/output_catcher.rb', line 15

def sniffed_io_stream
  @sniffed_io_stream
end

Instance Method Details

#distribute(method_name, *args, &block) ⇒ Object



22
23
24
25
26
# File 'lib/capistrano/ext/output_catcher.rb', line 22

def distribute(method_name, *args, &block)
  [ listening_io_stream, sniffed_io_stream ].each do |io_stream|
    io_stream.send(method_name, *args, &block)
  end
end