Class: Shell::Cat

Inherits:
BuiltInCommand show all
Defined in:
lib/shell/builtin-command.rb

Instance Attribute Summary

Attributes inherited from Filter

#input

Instance Method Summary collapse

Methods inherited from BuiltInCommand

#active?, #wait?

Methods inherited from Filter

#+, #<, #>, #>>, #inspect, #to_a, #to_s, #|

Constructor Details

#initialize(sh, *filenames) ⇒ Cat

Returns a new instance of Cat.



40
41
42
43
# File 'lib/shell/builtin-command.rb', line 40

def initialize(sh, *filenames)
  super sh
  @cat_files = filenames
end

Instance Method Details

#each(rs = nil) ⇒ Object



45
46
47
48
49
50
51
52
53
# File 'lib/shell/builtin-command.rb', line 45

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