mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* lib: Convert tabs to spaces for ruby files per
http://redmine.ruby-lang.org/projects/ruby/wiki/DeveloperHowto#coding-style Patch by Steve Klabnik [Ruby 1.9 - Bug #4730] Patch by Jason Dew [Ruby 1.9 - Feature #4718] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31635 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
34276148c4
commit
7bbf2f3085
67 changed files with 3823 additions and 3814 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue