Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Avoid regexp literals

  • Loading branch information...
commit 72a43b68a3ca3e30ea881014b778d6855098e7de 1 parent 64fe8b0
Joshua Peek josh authored

Showing 1 changed file with 2 additions and 2 deletions. Show diff stats Hide diff stats

  1. +2 2 lib/sprockets/context.rb
4 lib/sprockets/context.rb
@@ -86,11 +86,11 @@ def evaluate(filename, options = {})
86 86 data = data.sub(utf8_bom_re, '')
87 87 end
88 88 else
89   - utf8_bom_re = /\A\xEF\xBB\xBF/
  89 + utf8_bom_re = Regexp.new("\\A\\xEF\\xBB\\xBF")
90 90
91 91 if data =~ utf8_bom_re
92 92 data = data.gsub(utf8_bom_re, '')
93   - elsif data =~ /\A(\xEF\xBB\xBF|\xFE\xFF|\xFF\xFE)/
  93 + elsif data =~ Regexp.new("\\A(\\xFE\\xFF|\\xFF\\xFE)")
94 94 raise EncodingError, "#{pathname} has a unicode BOM." +
95 95 "Resave the file as UTF-8 or upgrade to Ruby 1.9"
96 96 end

0 comments on commit 72a43b6

Please sign in to comment.
Something went wrong with that request. Please try again.