diff options
Diffstat (limited to 'lib/shell/filter.rb')
-rw-r--r-- | lib/shell/filter.rb | 48 |
1 files changed, 24 insertions, 24 deletions
diff --git a/lib/shell/filter.rb b/lib/shell/filter.rb index 3f88d0f5d2..d07cc3dd07 100644 --- a/lib/shell/filter.rb +++ b/lib/shell/filter.rb @@ -1,8 +1,8 @@ # # shell/filter.rb - -# $Release Version: 0.7 $ -# $Revision$ -# by Keiju ISHITSUKA(keiju@ruby-lang.org) +# $Release Version: 0.7 $ +# $Revision$ +# by Keiju ISHITSUKA(keiju@ruby-lang.org) # # -- # @@ -19,8 +19,8 @@ class Shell include Enumerable def initialize(sh) - @shell = sh # parent shell - @input = nil # input filter + @shell = sh # parent shell + @input = nil # input filter end attr_reader :input @@ -32,52 +32,52 @@ class Shell def each(rs = nil) rs = @shell.record_separator unless rs if @input - @input.each(rs){|l| yield l} + @input.each(rs){|l| yield l} end end def < (src) case src when String - cat = Cat.new(@shell, src) - cat | self + cat = Cat.new(@shell, src) + cat | self when IO - self.input = src - self + self.input = src + self else - Shell.Fail Error::CantApplyMethod, "<", to.class + Shell.Fail Error::CantApplyMethod, "<", to.class end end def > (to) case to when String - dst = @shell.open(to, "w") - begin - each(){|l| dst << l} - ensure - dst.close - end + dst = @shell.open(to, "w") + begin + each(){|l| dst << l} + ensure + dst.close + end when IO - each(){|l| to << l} + each(){|l| to << l} else - Shell.Fail Error::CantApplyMethod, ">", to.class + Shell.Fail Error::CantApplyMethod, ">", to.class end self end def >> (to) begin - Shell.cd(@shell.pwd).append(to, self) + Shell.cd(@shell.pwd).append(to, self) rescue CantApplyMethod - Shell.Fail Error::CantApplyMethod, ">>", to.class + Shell.Fail Error::CantApplyMethod, ">>", to.class end end def | (filter) filter.input = self if active? - @shell.process_controller.start_job filter + @shell.process_controller.start_job filter end filter end @@ -100,9 +100,9 @@ class Shell def inspect if @shell.debug.kind_of?(Integer) && @shell.debug > 2 - super + super else - to_s + to_s end end end |