Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Changing const_regexp to check for constant name.

We need to return Regexp.escape(camel_cased_word)
if the split is blank.
  • Loading branch information...
commit 07d8294b943a7978f09720fac353498f462d716a 1 parent 85bb7d9
@arunagw arunagw authored
Showing with 3 additions and 0 deletions.
  1. +3 −0  activesupport/lib/active_support/inflector/methods.rb
View
3  activesupport/lib/active_support/inflector/methods.rb
@@ -322,6 +322,9 @@ def ordinalize(number)
# For instance, Foo::Bar::Baz will generate Foo(::Bar(::Baz)?)?
def const_regexp(camel_cased_word) #:nodoc:
parts = camel_cased_word.split("::")
+
+ return Regexp.escape(camel_cased_word) if parts.blank?
+
last = parts.pop
parts.reverse.inject(last) do |acc, part|
Please sign in to comment.
Something went wrong with that request. Please try again.