Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Regexp.union seems to have different results in 1.8

  • Loading branch information...
commit d80e4ee20e690dfc0f4ec31c41b873d607462872 1 parent 859a455
@tenderlove tenderlove authored
Showing with 3 additions and 3 deletions.
  1. +3 −3 activerecord/test/cases/helper.rb
View
6 activerecord/test/cases/helper.rb
@@ -70,8 +70,8 @@ class SQLCounter
attr_reader :ignore
- def initialize(ignore = Regexp.union(self.class.ignored_sql))
- @ignore = ignore
+ def initialize(ignore = self.class.ignored_sql)
+ @ignore = ignore
end
def call(name, start, finish, message_id, values)
@@ -79,7 +79,7 @@ def call(name, start, finish, message_id, values)
# FIXME: this seems bad. we should probably have a better way to indicate
# the query was cached
- return if 'CACHE' == values[:name] || ignore =~ sql
+ return if 'CACHE' == values[:name] || ignore.any? { |x| x =~ sql }
self.class.log << sql
end
end

4 comments on commit d80e4ee

@sobrinho

Are you sure?

This snippet produces exactly same result on ree-1.8.7-2011.03 and 1.9.3-p0

words = %w(foo bar baz)
puts Regexp.union(words)
# => (?-mix:foo|bar|baz)

regexps = [/foo/, /bar/, /baz/]
puts Regexp.union(regexps)
# => (?-mix:(?-mix:foo)|(?-mix:bar)|(?-mix:baz))
@tenderlove
Owner
@carlosantoniodasilva

Can we revert it now on master? =)

@carlosantoniodasilva

Well, I've sent a pull request reverting this and another 1.8 compat change.

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