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.



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