Permalink
Browse files

to_ary must return an Array on 1.8

The goal of the change was to avoid calls to method_missing, but
defining to_ary was not the correct choice.  This fails on 1.8, where it
must return an Array.  This makes a Gem::Specification appear as if it
were an Array which it is not.

Instead respond_to_missing? is defined which returns false.  I did not
test if this is more or less efficient than defining to_ary.

This reverts @54cf153 from #477
  • Loading branch information...
1 parent a2beb79 commit 8ec05916902fcc001f77d0169cb4c8b4a31ba42d @drbrain drbrain committed Jul 11, 2013
Showing with 4 additions and 5 deletions.
  1. +4 −5 lib/rubygems/specification.rb
@@ -1853,11 +1853,6 @@ def method_missing(sym, *a, &b) # :nodoc:
end
end
- # Prevent ruby hitting spec.method_missing when [[spec]].flatten is called
- def to_ary # :nodoc:
- nil
- end
-
##
# Normalize the list of files so that:
# * All file lists have redundancies removed.
@@ -2008,6 +2003,10 @@ def requirements= req
@requirements = Array req
end
+ def respond_to_missing? m, include_private = false # :nodoc:
+ false
+ end
+
##
# Returns the full path to this spec's ri directory.

0 comments on commit 8ec0591

Please sign in to comment.