Make this more idiomatic

This commit is contained in:
Jack Nagel 2013-02-15 00:35:52 -06:00
parent 2ef79d1387
commit 9fd5953ed9

View File

@ -55,9 +55,7 @@ module StringInreplaceExtension
# Removes variable assignments completely.
def remove_make_var! flags
# Next line is for Ruby 1.9.x compatibility
flags = [flags] unless flags.kind_of? Array
flags.each do |flag|
Array(flags).each do |flag|
# Also remove trailing \n, if present.
sub = gsub! Regexp.new("^#{flag}[ \\t]*=(.*)$\n?"), "", false
opoo "inreplace: removing '#{flag}' failed" if sub.nil?