Overwrite compact on child class of Array to not return an instance of Array

This is necessary because in Ruby 1.9.3, the behavior of an internal dup of
the array (rb_ary_dup) was changed to always return an array instance, not
an instance of the actual class which it was working on.

Why can't people just stick to what works but instead try to have special
snowflakes everywhere? </rant>
This commit is contained in:
Holger Just 2012-01-03 19:45:38 +01:00
parent 49cd6f87aa
commit 0f0e42448a
1 changed files with 8 additions and 0 deletions

View File

@ -251,6 +251,14 @@ module Redmine
def revisions
revisions ||= Revisions.new(collect{|entry| entry.lastrev}.compact)
end
# Required since Ruby 1.9.3 as the core compact always returns an
# instance of Array. This method follows the spec for Array#compact
def compact
ary = self.dup
ary.compact!
ary
end
end
class Info