Class: Shell::AppendIO

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

Overview

class Sort < Cat

  def initialize(sh, *filenames)
    super
  end

  def each(rs = nil)
    ary = []
    super{|l|       ary.push l}
    for l in ary.sort!
    yield l
    end
  end
end

Direct Known Subclasses

AppendFile

Instance Attribute Summary

Attributes inherited from Filter

#input

Instance Method Summary collapse

Methods inherited from BuiltInCommand

#active?, #wait?

Methods inherited from Filter

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

Constructor Details

#initialize(sh, io, filter) ⇒ AppendIO

Returns a new instance of AppendIO.



101
102
103
104
105
# File 'lib/shell/builtin-command.rb', line 101

def initialize(sh, io, filter)
  super sh
  @input = filter
  @io = io
end

Instance Method Details

#input=(filter) ⇒ Object



107
108
109
110
111
112
# File 'lib/shell/builtin-command.rb', line 107

def input=(filter)
  @input.input=filter
  for l in @input
    @io << l
  end
end