Browse files

Avoid regexp literals

  • Loading branch information...
1 parent 64fe8b0 commit 72a43b68a3ca3e30ea881014b778d6855098e7de @josh josh committed Jun 7, 2011
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

0 comments on commit 72a43b6

Please sign in to comment.