Class: Sheepsafe::Controller::TeeStdout

Inherits:
Object
  • Object
show all
Defined in:
lib/sheepsafe/controller.rb

Instance Method Summary collapse

Constructor Details

#initialize(controller) ⇒ TeeStdout

Returns a new instance of TeeStdout.



13
14
15
# File 'lib/sheepsafe/controller.rb', line 13

def initialize(controller)
  @stdout, @controller = $stdout, controller
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

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



22
23
24
25
# File 'lib/sheepsafe/controller.rb', line 22

def method_missing(meth, *args, &block)
  @stdout.send(meth, *args, &block)
  @controller.with_log_file {|f| f.send(meth, *args, &block) }
end

Instance Method Details

#write(*args, &block) ⇒ Object



17
18
19
20
# File 'lib/sheepsafe/controller.rb', line 17

def write(*args,&block)
  @stdout.write(*args, &block)
  @controller.with_log_file {|f| f.write(*args, &block) }
end