Class: Sheepsafe::Controller::TeeStdout
- Inherits:
-
Object
- Object
- Sheepsafe::Controller::TeeStdout
- Defined in:
- lib/sheepsafe/controller.rb
Instance Method Summary collapse
-
#initialize(controller) ⇒ TeeStdout
constructor
A new instance of TeeStdout.
- #method_missing(meth, *args, &block) ⇒ Object
- #write(*args, &block) ⇒ Object
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 |