Permalink
Browse files

Merge pull request #447 from jonleighton/perf_tweaks

Perf tweaks
  • Loading branch information...
2 parents 2d4bb00 + 54cf153 commit 34fe6544fa0d63b08a827dd4ad02b12b3b7bb090 @evanphx evanphx committed Jun 26, 2013
Showing with 15 additions and 1 deletion.
  1. +5 −0 lib/rubygems/specification.rb
  2. +10 −1 lib/rubygems/version.rb
@@ -1854,6 +1854,11 @@ 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.
View
@@ -153,7 +153,10 @@ class Gem::Version
##
# A string representation of this Version.
- attr_reader :version
+ def version
+ @version.dup
+ end
+
alias to_s version
##
@@ -183,6 +186,12 @@ def self.create input
end
end
+ @@all = {}
+
+ def self.new version
+ @@all[version] ||= super
+ end
+
##
# Constructs a Version from the +version+ string. A version string is a
# series of digits or ASCII letters separated by dots.

0 comments on commit 34fe654

Please sign in to comment.