1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

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
This commit is contained in:
nobu 2014-10-17 06:30:08 +00:00
parent 99eeaca547
commit ae7de68961

View file

@ -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