diff --git a/VERSION.yml b/VERSION.yml index fa0aaa5b..86b8d24c 100644 --- a/VERSION.yml +++ b/VERSION.yml @@ -1,5 +1,5 @@ --- :major: 1 :minor: 13 -:patch: 0 +:patch: 1 :build: diff --git a/backports.gemspec b/backports.gemspec index 02af06c0..037fc03c 100644 --- a/backports.gemspec +++ b/backports.gemspec @@ -5,11 +5,11 @@ Gem::Specification.new do |s| s.name = %q{backports} - s.version = "1.13.0" + s.version = "1.13.1" s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version= s.authors = ["Marc-Andr\303\251 Lafortune"] - s.date = %q{2010-01-20} + s.date = %q{2010-01-22} s.description = %q{ Essential backports that enable some of the really nice features of ruby 1.8.7, ruby 1.9 and rails from ruby 1.8.6 and earlier. } s.email = %q{github@marc-andre.ca} diff --git a/lib/backports/1.8.7/hash.rb b/lib/backports/1.8.7/hash.rb index a0544cc5..4a6152a8 100644 --- a/lib/backports/1.8.7/hash.rb +++ b/lib/backports/1.8.7/hash.rb @@ -18,6 +18,24 @@ def [](*args) end end + # Ruby 1.8.6 doesn't define a Hash specific hash method + def hash + h = 0 + each do |key, value| + h ^= key.hash ^ value.hash + end + h + end unless {}.hash == {}.hash + + # Ruby 1.8.6 doesn't define a Hash specific eql? method. + def eql?(other) + other.is_a?(Hash) && + size == other.size && + all? do |key, value| + other.fetch(key){return false}.eql?(value) + end + end unless {}.eql?({}) + Backports.make_block_optional self, :delete_if, :each, :each_key, :each_pair, :each_value, :reject, :reject!, :select, :test_on => {:hello => "world!"} # Standard in Ruby 1.8.7+. See official documentation[http://ruby-doc.org/core-1.9/classes/Hash.html]