123456789_123456789_123456789_123456789_123456789_

Class: Shell::Cat

Relationships & Source Files
Super Chains via Extension / Inclusion / Inheritance
Class Chain:
Instance Chain:
self, BuiltInCommand, Filter, Enumerable
Inherits: Shell::BuiltInCommand
Defined in: lib/shell/builtin-command.rb

Class Method Summary

Filter - Inherited

Instance Attribute Summary

BuiltInCommand - Inherited

Filter - Inherited

Instance Method Summary

Filter - Inherited

#+

Outputs filter1, and then filter2 using Join.new

#<

Inputs from source, which is either a string of a file name or an IO object.

#>

Outputs from source, which is either a string of a file name or an IO object.

#>>

Appends the output to source, which is either a string of a file name or an IO object.

#each

Iterates a block for each line.

#inspect, #to_a, #to_s,
#|

Processes a pipeline.

Constructor Details

.new(sh, *filenames) ⇒ Cat

[ GitHub ]

  
# File 'lib/shell/builtin-command.rb', line 49

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

Instance Method Details

#each(rs = nil)

[ GitHub ]

  
# 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