Class: Shell::Tee
- Inherits:
-
BuiltInCommand
- Object
- Filter
- BuiltInCommand
- Shell::Tee
- Defined in:
- lib/shell/builtin-command.rb
Instance Attribute Summary
Attributes inherited from Filter
Instance Method Summary collapse
- #each(rs = nil) ⇒ Object
-
#initialize(sh, filename) ⇒ Tee
constructor
A new instance of Tee.
Methods inherited from BuiltInCommand
Methods inherited from Filter
#+, #<, #>, #>>, #inspect, #to_a, #to_s, #|
Constructor Details
#initialize(sh, filename) ⇒ Tee
Returns a new instance of Tee.
133 134 135 136 |
# File 'lib/shell/builtin-command.rb', line 133 def initialize(sh, filename) super sh @to_filename = filename end |
Instance Method Details
#each(rs = nil) ⇒ Object
138 139 140 141 142 143 144 145 |
# File 'lib/shell/builtin-command.rb', line 138 def each(rs = nil) to = @shell.open(@to_filename, "w") begin super{|l| to << l; yield l} ensure to.close end end |