diff options
author | drbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-04-17 21:17:56 +0000 |
---|---|---|
committer | drbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-04-17 21:17:56 +0000 |
commit | 0ebe38eedd3b0b0771f57e1d4a85d472a1b6b64f (patch) | |
tree | 3fd875633a962ad584d787f536e5ced1697e058e /lib/rubygems/requirement.rb | |
parent | 02dc9ae773d458be60f3fa656d5bb50f41a1c9e2 (diff) |
Revert r35370 due to bad source branch
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35372 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/rubygems/requirement.rb')
-rw-r--r-- | lib/rubygems/requirement.rb | 51 |
1 files changed, 27 insertions, 24 deletions
diff --git a/lib/rubygems/requirement.rb b/lib/rubygems/requirement.rb index 7abff01c39..ed5cacc237 100644 --- a/lib/rubygems/requirement.rb +++ b/lib/rubygems/requirement.rb @@ -1,18 +1,35 @@ require "rubygems/version" +# :stopdoc: + +# Hack to handle syck's DefaultKey bug with psych +# +# Quick note! If/when psych loads in 1.9, it will redefine +# YAML to point to Psych by removing the YAML constant. +# Thusly, over in Gem.load_yaml, we define DefaultKey again +# after proper yaml library has been loaded. +# +# All this is so that there is always a YAML::Syck::DefaultKey +# class no matter if the full yaml library has loaded or not. +# +module YAML + if !defined? Syck + module Syck + class DefaultKey + def to_s + '=' + end + end + end + end +end + +# :startdoc: + ## # A Requirement is a set of one or more version restrictions. It supports a # few (<tt>=, !=, >, <, >=, <=, ~></tt>) different restriction operators. -# REFACTOR: The fact that a requirement is singular or plural is kind of -# awkward. Is Requirement the right name for this? Or should it be one -# [op, number] pair, and we call the list of requirements something else? -# Since a Requirement is held by a Dependency, maybe this should be made -# singular and the list aspect should be pulled up into Dependency? - -require "rubygems/version" -require "rubygems/deprecate" - class Gem::Requirement include Comparable @@ -130,18 +147,6 @@ class Gem::Requirement fix_syck_default_key_in_requirements end - def yaml_initialize(tag, vals) # :nodoc: - vals.each do |ivar, val| - instance_variable_set "@#{ivar}", val - end - - fix_syck_default_key_in_requirements - end - - def init_with coder # :nodoc: - yaml_initialize coder.tag, coder.map - end - def prerelease? requirements.any? { |r| r.last.prerelease? } end @@ -183,11 +188,9 @@ class Gem::Requirement private def fix_syck_default_key_in_requirements - Gem.load_yaml - # Fixup the Syck DefaultKey bug @requirements.each do |r| - if r[0].kind_of? Gem::SyckDefaultKey + if r[0].kind_of? YAML::Syck::DefaultKey r[0] = "=" end end |