Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Avoid regexp literals

  • Loading branch information...
commit 72a43b68a3ca3e30ea881014b778d6855098e7de 1 parent 64fe8b0
@josh josh authored
Showing with 2 additions and 2 deletions.
  1. +2 −2 lib/sprockets/context.rb
View
4 lib/sprockets/context.rb
@@ -86,11 +86,11 @@ def evaluate(filename, options = {})
data = data.sub(utf8_bom_re, '')
end
else
- utf8_bom_re = /\A\xEF\xBB\xBF/
+ utf8_bom_re = Regexp.new("\\A\\xEF\\xBB\\xBF")
if data =~ utf8_bom_re
data = data.gsub(utf8_bom_re, '')
- elsif data =~ /\A(\xEF\xBB\xBF|\xFE\xFF|\xFF\xFE)/
+ elsif data =~ Regexp.new("\\A(\\xFE\\xFF|\\xFF\\xFE)")
raise EncodingError, "#{pathname} has a unicode BOM." +
"Resave the file as UTF-8 or upgrade to Ruby 1.9"
end
Please sign in to comment.
Something went wrong with that request. Please try again.