Class: Shell::Cat
- Inherits:
-
BuiltInCommand
- Object
- Filter
- BuiltInCommand
- Shell::Cat
- Defined in:
- lib/shell/builtin-command.rb
Instance Attribute Summary
Attributes inherited from Filter
Instance Method Summary collapse
- #each(rs = nil) ⇒ Object
-
#initialize(sh, *filenames) ⇒ Cat
constructor
A new instance of Cat.
Methods inherited from BuiltInCommand
Methods inherited from Filter
#+, #<, #>, #>>, #inspect, #to_a, #to_s, #|
Constructor Details
#initialize(sh, *filenames) ⇒ Cat
Returns a new instance of Cat.
49 50 51 52 |
# File 'lib/shell/builtin-command.rb', line 49 def initialize(sh, *filenames) super sh @cat_files = filenames end |
Instance Method Details
#each(rs = nil) ⇒ Object
54 55 56 57 58 59 60 61 62 |
# File 'lib/shell/builtin-command.rb', line 54 def each(rs = nil) if @cat_files.empty? super else for src in @cat_files @shell.foreach(src, rs){|l| yield l} end end end |