Permalink
Browse files

fixes #2217 - initialize Regexp constants here to stop duplicate war…

…nings
  • Loading branch information...
Dominic Cleal authored and ohadlevy committed Feb 20, 2013
1 parent 59e6620 commit c09b1dfeed4b83c4dc18921c848055e6b31e9fca
Showing with 15 additions and 0 deletions.
  1. +1 −0 Gemfile
  2. +14 −0 lib/regexp_extensions.rb
View
@@ -1,4 +1,5 @@
require File.expand_path('../config/settings', __FILE__)
+require File.expand_path('../lib/regexp_extensions', __FILE__)
source 'http://rubygems.org'
gem 'rails', '3.0.20'
View
@@ -0,0 +1,14 @@
+# From ruby_parser 3.x to fix warnings under ruby_parser 2.x
+#
+# ruby2ruby sets some constants, but not ONCE. ruby_parser 2.x checks for
+# ONCE and then causes duplicate definitions of ENC_*.
+class Regexp
+ ONCE = 0 unless defined? ONCE # FIX: remove this - it makes no sense
+
+ unless defined? ENC_NONE then
+ ENC_NONE = /x/n.options
+ ENC_EUC = /x/e.options
+ ENC_SJIS = /x/s.options
+ ENC_UTF8 = /x/u.options
+ end
+end

0 comments on commit c09b1df

Please sign in to comment.