backports 1.13.0 → 1.13.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/VERSION.yml +1 -1
- data/backports.gemspec +2 -2
- data/lib/backports/1.8.7/hash.rb +18 -0
- metadata +2 -2
data/VERSION.yml
CHANGED
data/backports.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{backports}
|
8
|
-
s.version = "1.13.
|
8
|
+
s.version = "1.13.1"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Marc-Andr\303\251 Lafortune"]
|
12
|
-
s.date = %q{2010-01-
|
12
|
+
s.date = %q{2010-01-22}
|
13
13
|
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.
|
14
14
|
}
|
15
15
|
s.email = %q{github@marc-andre.ca}
|
data/lib/backports/1.8.7/hash.rb
CHANGED
@@ -18,6 +18,24 @@ class Hash
|
|
18
18
|
end
|
19
19
|
end
|
20
20
|
|
21
|
+
# Ruby 1.8.6 doesn't define a Hash specific hash method
|
22
|
+
def hash
|
23
|
+
h = 0
|
24
|
+
each do |key, value|
|
25
|
+
h ^= key.hash ^ value.hash
|
26
|
+
end
|
27
|
+
h
|
28
|
+
end unless {}.hash == {}.hash
|
29
|
+
|
30
|
+
# Ruby 1.8.6 doesn't define a Hash specific eql? method.
|
31
|
+
def eql?(other)
|
32
|
+
other.is_a?(Hash) &&
|
33
|
+
size == other.size &&
|
34
|
+
all? do |key, value|
|
35
|
+
other.fetch(key){return false}.eql?(value)
|
36
|
+
end
|
37
|
+
end unless {}.eql?({})
|
38
|
+
|
21
39
|
Backports.make_block_optional self, :delete_if, :each, :each_key, :each_pair, :each_value, :reject, :reject!, :select, :test_on => {:hello => "world!"}
|
22
40
|
|
23
41
|
# Standard in Ruby 1.8.7+. See official documentation[http://ruby-doc.org/core-1.9/classes/Hash.html]
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: backports
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.13.
|
4
|
+
version: 1.13.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- "Marc-Andr\xC3\xA9 Lafortune"
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2010-01-
|
12
|
+
date: 2010-01-22 00:00:00 -05:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|