summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-10-17 06:30:08 (GMT)
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-10-17 06:30:08 (GMT)
commitae7de68961f017c66ad6fb90b1f416c7e674705c (patch)
tree463653e8e569224a9dba00f95e90a00183d2ed57 /bin
parent99eeaca5479b4f27eb6ca086924b0b04752d7a3a (diff)
erb: multiline anchors
* bin/erb (ARGV.switch, ERB::Main#run): use beginning/end of string anchors instead of beginning/end of line anchors. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47994 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'bin')
-rwxr-xr-xbin/erb7
1 files changed, 4 insertions, 3 deletions
diff --git a/bin/erb b/bin/erb
index 2459680..bd04e69 100755
--- a/bin/erb
+++ b/bin/erb
@@ -11,7 +11,8 @@ class ERB
return nil if self.empty?
arg = self.shift
return nil if arg == '--'
- if arg =~ /^-(.)(.*)/
+ case arg
+ when /\A-(.)(.*)/
if $1 == '-'
arg, @maybe_arg = arg.split(/=/, 2)
return arg
@@ -72,7 +73,7 @@ class ERB
require ARGV.req_arg
when '-S' # security level
arg = ARGV.req_arg
- raise "invalid safe_level #{arg.dump}" unless arg =~ /^[0-3]$/
+ raise "invalid safe_level #{arg.dump}" unless arg =~ /\A[0-3]\z/
safe_level = arg.to_i
when '-T' # trim mode
arg = ARGV.req_arg
@@ -80,7 +81,7 @@ class ERB
trim_mode = arg
next
end
- raise "invalid trim mode #{arg.dump}" unless arg =~ /^[0-2]$/
+ raise "invalid trim mode #{arg.dump}" unless arg =~ /\A[0-2]\z/
trim_mode = arg.to_i
when '-E', '--encoding'
arg = ARGV.req_arg