diff options
-rw-r--r-- | lib/shell/builtin-command.rb | 62 |
1 files changed, 31 insertions, 31 deletions
@@ -1,8 +1,8 @@ # # shell/builtin-command.rb - -# $Release Version: 0.7 $ -# $Revision$ -# by Keiju ISHITSUKA([email protected]) # # -- # @@ -40,7 +40,7 @@ class Shell def each(rs = nil) rs = @shell.record_separator unless rs for str in @strings - yield str + rs end end end @@ -53,11 +53,11 @@ class Shell 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 end @@ -71,31 +71,31 @@ class Shell def each(rs = nil) if @pattern[0] == ?/ - @files = Dir[@pattern] else - prefix = @shell.pwd+"/" - @files = Dir[prefix+@pattern].collect{|p| p.sub(prefix, "")} end rs = @shell.record_separator unless rs for f in @files - yield f+rs end end end -# 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 class AppendIO < BuiltInCommand def initialize(sh, io, filter) @@ -107,7 +107,7 @@ class Shell def input=(filter) @input.input=filter for l in @input - @io << l end end @@ -122,9 +122,9 @@ class Shell def input=(filter) begin - super ensure - @io.close end end end @@ -138,9 +138,9 @@ class Shell def each(rs = nil) to = @shell.open(@to_filename, "w") begin - super{|l| to << l; yield l} ensure - to.close end end end @@ -153,7 +153,7 @@ class Shell def each(rs = nil) while job = @jobs.shift - job.each{|l| yield l} end end end |