mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* bin/erb: removed trailing spaces.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27175 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
10547e3c41
commit
0c216c32dc
1 changed files with 6 additions and 6 deletions
12
bin/erb
12
bin/erb
|
@ -1,6 +1,6 @@
|
||||||
#!/usr/bin/env ruby
|
#!/usr/bin/env ruby
|
||||||
# Tiny eRuby --- ERB2
|
# Tiny eRuby --- ERB2
|
||||||
# Copyright (c) 1999-2000,2002 Masatoshi SEKI
|
# Copyright (c) 1999-2000,2002 Masatoshi SEKI
|
||||||
# You can redistribute it and/or modify it under the same terms as Ruby.
|
# You can redistribute it and/or modify it under the same terms as Ruby.
|
||||||
|
|
||||||
require 'erb'
|
require 'erb'
|
||||||
|
@ -14,11 +14,11 @@ class ERB
|
||||||
if arg =~ /^-(.)(.*)/
|
if arg =~ /^-(.)(.*)/
|
||||||
if $1 == '-'
|
if $1 == '-'
|
||||||
arg, @maybe_arg = arg.split(/=/, 2)
|
arg, @maybe_arg = arg.split(/=/, 2)
|
||||||
return arg
|
return arg
|
||||||
end
|
end
|
||||||
raise 'unknown switch "-"' if $2[0] == ?- and $1 != 'T'
|
raise 'unknown switch "-"' if $2[0] == ?- and $1 != 'T'
|
||||||
if $2.size > 0
|
if $2.size > 0
|
||||||
self.unshift "-#{$2}"
|
self.unshift "-#{$2}"
|
||||||
@maybe_arg = $2
|
@maybe_arg = $2
|
||||||
else
|
else
|
||||||
@maybe_arg = nil
|
@maybe_arg = nil
|
||||||
|
@ -29,7 +29,7 @@ class ERB
|
||||||
nil
|
nil
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def ARGV.req_arg
|
def ARGV.req_arg
|
||||||
(@maybe_arg || self.shift || raise('missing argument')).tap {
|
(@maybe_arg || self.shift || raise('missing argument')).tap {
|
||||||
@maybe_arg = nil
|
@maybe_arg = nil
|
||||||
|
@ -77,7 +77,7 @@ class ERB
|
||||||
when '-T' # trim mode
|
when '-T' # trim mode
|
||||||
arg = ARGV.req_arg
|
arg = ARGV.req_arg
|
||||||
if arg == '-'
|
if arg == '-'
|
||||||
trim_mode = arg
|
trim_mode = arg
|
||||||
next
|
next
|
||||||
end
|
end
|
||||||
raise "invalid trim mode #{arg.dump}" unless arg =~ /^[0-2]$/
|
raise "invalid trim mode #{arg.dump}" unless arg =~ /^[0-2]$/
|
||||||
|
@ -97,7 +97,7 @@ class ERB
|
||||||
end
|
end
|
||||||
rescue # usage
|
rescue # usage
|
||||||
STDERR.puts $!.to_s
|
STDERR.puts $!.to_s
|
||||||
STDERR.puts File.basename($0) +
|
STDERR.puts File.basename($0) +
|
||||||
" [switches] [inputfile]"
|
" [switches] [inputfile]"
|
||||||
STDERR.puts <<EOU
|
STDERR.puts <<EOU
|
||||||
-x print ruby script
|
-x print ruby script
|
||||||
|
|
Loading…
Reference in a new issue