backports 3.10.3 → 3.11.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +13 -5
- data/.travis.yml +3 -3
- data/README.rdoc +47 -13
- data/Rakefile +10 -0
- data/frozen_old_spec/tags/1.8.6/core/array/append_spec.rb +1 -0
- data/frozen_old_spec/tags/1.8.6/core/enumerable/all_spec.rb +1 -0
- data/frozen_old_spec/tags/1.8.6/core/enumerable/any_spec.rb +2 -0
- data/frozen_old_spec/tags/1.8.6/core/enumerable/none_spec.rb +1 -0
- data/frozen_old_spec/tags/1.8.6/core/enumerable/one_spec.rb +1 -0
- data/frozen_old_spec/tags/1.8.6/core/module/alias_method_spec.rb +1 -0
- data/frozen_old_spec/tags/1.8.6/core/module/attr_accessor_spec.rb +2 -0
- data/frozen_old_spec/tags/1.8.6/core/module/attr_reader_spec.rb +2 -0
- data/frozen_old_spec/tags/1.8.6/core/module/attr_spec.rb +1 -0
- data/frozen_old_spec/tags/1.8.6/core/module/attr_writer_spec.rb +2 -0
- data/frozen_old_spec/tags/1.8.6/core/module/define_method_spec.rb +1 -0
- data/frozen_old_spec/tags/1.8.6/core/module/remove_method_spec.rb +1 -0
- data/frozen_old_spec/tags/1.8.6/core/module/undef_method_spec.rb +1 -0
- data/frozen_old_spec/tags/1.8.7/core/array/append_spec.rb +1 -0
- data/frozen_old_spec/tags/1.8.7/core/enumerable/all_spec.rb +1 -0
- data/frozen_old_spec/tags/1.8.7/core/enumerable/any_spec.rb +2 -0
- data/frozen_old_spec/tags/1.8.7/core/enumerable/none_spec.rb +1 -0
- data/frozen_old_spec/tags/1.8.7/core/enumerable/one_spec.rb +1 -0
- data/frozen_old_spec/tags/1.8.7/core/module/alias_method_spec.rb +7 -0
- data/frozen_old_spec/tags/1.8.7/core/module/attr_accessor_spec.rb +2 -0
- data/frozen_old_spec/tags/1.8.7/core/module/attr_reader_spec.rb +2 -0
- data/frozen_old_spec/tags/1.8.7/core/module/attr_spec.rb +2 -0
- data/frozen_old_spec/tags/1.8.7/core/module/attr_writer_spec.rb +2 -0
- data/frozen_old_spec/tags/1.8.7/core/module/define_method_spec.rb +1 -0
- data/frozen_old_spec/tags/1.8.7/core/module/remove_method_spec.rb +3 -0
- data/frozen_old_spec/tags/1.8.7/core/module/undef_method_spec.rb +3 -0
- data/frozen_old_spec/tags/1.8.7/core/struct/new_spec.rb +3 -0
- data/frozen_old_spec/tags/1.9.1/core/array/append_spec.rb +1 -0
- data/frozen_old_spec/tags/1.9.1/core/enumerable/all_spec.rb +1 -0
- data/frozen_old_spec/tags/1.9.1/core/enumerable/any_spec.rb +2 -0
- data/frozen_old_spec/tags/1.9.1/core/enumerable/none_spec.rb +1 -0
- data/frozen_old_spec/tags/1.9.1/core/enumerable/one_spec.rb +1 -0
- data/frozen_old_spec/tags/1.9.1/core/module/alias_method_spec.rb +4 -0
- data/frozen_old_spec/tags/1.9.1/core/module/attr_accessor_spec.rb +2 -0
- data/frozen_old_spec/tags/1.9.1/core/module/attr_reader_spec.rb +2 -0
- data/frozen_old_spec/tags/1.9.1/core/module/attr_spec.rb +1 -0
- data/frozen_old_spec/tags/1.9.1/core/module/attr_writer_spec.rb +2 -0
- data/frozen_old_spec/tags/1.9.1/core/module/define_method_spec.rb +3 -0
- data/frozen_old_spec/tags/1.9.1/core/module/remove_method_spec.rb +1 -0
- data/frozen_old_spec/tags/1.9.1/core/module/undef_method_spec.rb +1 -0
- data/frozen_old_spec/tags/1.9.2/core/array/append_spec.rb +1 -0
- data/frozen_old_spec/tags/1.9.2/core/enumerable/all_spec.rb +1 -0
- data/frozen_old_spec/tags/1.9.2/core/enumerable/any_spec.rb +2 -0
- data/frozen_old_spec/tags/1.9.2/core/enumerable/none_spec.rb +1 -0
- data/frozen_old_spec/tags/1.9.2/core/enumerable/one_spec.rb +1 -0
- data/frozen_old_spec/tags/1.9.2/core/module/alias_method_spec.rb +4 -0
- data/frozen_old_spec/tags/1.9.2/core/module/attr_accessor_spec.rb +2 -0
- data/frozen_old_spec/tags/1.9.2/core/module/attr_reader_spec.rb +2 -0
- data/frozen_old_spec/tags/1.9.2/core/module/attr_spec.rb +1 -0
- data/frozen_old_spec/tags/1.9.2/core/module/attr_writer_spec.rb +2 -0
- data/frozen_old_spec/tags/1.9.2/core/module/define_method_spec.rb +3 -0
- data/frozen_old_spec/tags/1.9.2/core/module/remove_method_spec.rb +1 -0
- data/frozen_old_spec/tags/1.9.2/core/module/undef_method_spec.rb +1 -0
- data/frozen_old_spec/tags/1.9.3/core/enumerable/any_spec.rb +1 -0
- data/frozen_old_spec/tags/1.9.3/core/module/alias_method_spec.rb +4 -0
- data/frozen_old_spec/tags/1.9.3/core/module/attr_accessor_spec.rb +1 -0
- data/frozen_old_spec/tags/1.9.3/core/module/attr_reader_spec.rb +1 -0
- data/frozen_old_spec/tags/1.9.3/core/module/attr_spec.rb +1 -0
- data/frozen_old_spec/tags/1.9.3/core/module/attr_writer_spec.rb +1 -0
- data/frozen_old_spec/tags/1.9.3/core/module/define_method_spec.rb +3 -0
- data/frozen_old_spec/tags/1.9.3/core/module/remove_method_spec.rb +1 -0
- data/frozen_old_spec/tags/1.9.3/core/module/undef_method_spec.rb +1 -0
- data/frozen_old_spec/tags/2.0.0/core/enumerable/any_spec.rb +1 -0
- data/frozen_old_spec/tags/2.0.0/core/module/alias_method_spec.rb +1 -0
- data/frozen_old_spec/tags/2.0.0/core/module/attr_accessor_spec.rb +2 -0
- data/frozen_old_spec/tags/2.0.0/core/module/attr_reader_spec.rb +2 -0
- data/frozen_old_spec/tags/2.0.0/core/module/attr_spec.rb +1 -0
- data/frozen_old_spec/tags/2.0.0/core/module/attr_writer_spec.rb +2 -0
- data/frozen_old_spec/tags/2.0.0/core/module/define_method_spec.rb +2 -0
- data/frozen_old_spec/tags/2.0.0/core/module/remove_method_spec.rb +1 -0
- data/frozen_old_spec/tags/2.0.0/core/module/undef_method_spec.rb +1 -0
- data/frozen_old_spec/tags/2.0.0/core/struct/new_spec.rb +1 -0
- data/frozen_old_spec/tags/2.1.0/core/enumerable/any_spec.rb +1 -0
- data/frozen_old_spec/tags/2.1.0/core/module/alias_method_spec.rb +1 -0
- data/frozen_old_spec/tags/2.1.0/core/module/attr_accessor_spec.rb +2 -0
- data/frozen_old_spec/tags/2.1.0/core/module/attr_reader_spec.rb +2 -0
- data/frozen_old_spec/tags/2.1.0/core/module/attr_spec.rb +1 -0
- data/frozen_old_spec/tags/2.1.0/core/module/attr_writer_spec.rb +2 -0
- data/frozen_old_spec/tags/2.1.0/core/module/define_method_spec.rb +2 -0
- data/frozen_old_spec/tags/2.1.0/core/module/remove_method_spec.rb +1 -0
- data/frozen_old_spec/tags/2.1.0/core/module/undef_method_spec.rb +1 -0
- data/frozen_old_spec/tags/2.1.0/core/struct/new_spec.rb +1 -0
- data/frozen_old_spec/tags/2.2.0/core/enumerable/any_spec.rb +1 -0
- data/frozen_old_spec/tags/2.2.0/core/module/alias_method_spec.rb +1 -0
- data/frozen_old_spec/tags/2.2.0/core/module/attr_accessor_spec.rb +2 -0
- data/frozen_old_spec/tags/2.2.0/core/module/attr_reader_spec.rb +2 -0
- data/frozen_old_spec/tags/2.2.0/core/module/attr_spec.rb +1 -0
- data/frozen_old_spec/tags/2.2.0/core/module/attr_writer_spec.rb +2 -0
- data/frozen_old_spec/tags/2.2.0/core/module/define_method_spec.rb +1 -0
- data/frozen_old_spec/tags/2.2.0/core/module/remove_method_spec.rb +1 -0
- data/frozen_old_spec/tags/2.2.0/core/module/undef_method_spec.rb +1 -0
- data/frozen_old_spec/tags/2.2.0/core/struct/new_spec.rb +1 -0
- data/frozen_old_spec/tags/2.3.0/core/enumerable/any_spec.rb +1 -0
- data/frozen_old_spec/tags/2.3.0/core/module/alias_method_spec.rb +1 -0
- data/frozen_old_spec/tags/2.3.0/core/module/attr_accessor_spec.rb +2 -0
- data/frozen_old_spec/tags/2.3.0/core/module/attr_reader_spec.rb +2 -0
- data/frozen_old_spec/tags/2.3.0/core/module/attr_spec.rb +1 -0
- data/frozen_old_spec/tags/2.3.0/core/module/attr_writer_spec.rb +2 -0
- data/frozen_old_spec/tags/2.3.0/core/module/define_method_spec.rb +1 -0
- data/frozen_old_spec/tags/2.3.0/core/module/remove_method_spec.rb +1 -0
- data/frozen_old_spec/tags/2.3.0/core/module/undef_method_spec.rb +1 -0
- data/frozen_old_spec/tags/2.3.0/core/struct/new_spec.rb +1 -0
- data/frozen_old_spec/tags/2.3.5/core/struct/new_spec.rb +1 -0
- data/frozen_old_spec/tags/2.4.0/core/enumerable/any_spec.rb +1 -0
- data/frozen_old_spec/tags/2.4.0/core/module/alias_method_spec.rb +1 -0
- data/frozen_old_spec/tags/2.4.0/core/module/attr_accessor_spec.rb +2 -0
- data/frozen_old_spec/tags/2.4.0/core/module/attr_reader_spec.rb +2 -0
- data/frozen_old_spec/tags/2.4.0/core/module/attr_spec.rb +1 -0
- data/frozen_old_spec/tags/2.4.0/core/module/attr_writer_spec.rb +2 -0
- data/frozen_old_spec/tags/2.4.0/core/module/define_method_spec.rb +1 -0
- data/frozen_old_spec/tags/2.4.0/core/module/remove_method_spec.rb +1 -0
- data/frozen_old_spec/tags/2.4.0/core/module/undef_method_spec.rb +1 -0
- data/frozen_old_spec/tags/2.4.0/core/struct/new_spec.rb +1 -0
- data/frozen_old_spec/tags/2.5.0/core/enumerable/any_spec.rb +1 -0
- data/frozen_old_spec/tags/2.5.0/core/module/alias_method_spec.rb +1 -0
- data/frozen_old_spec/tags/2.5.0/core/module/attr_accessor_spec.rb +2 -0
- data/frozen_old_spec/tags/2.5.0/core/module/attr_reader_spec.rb +2 -0
- data/frozen_old_spec/tags/2.5.0/core/module/attr_spec.rb +1 -0
- data/frozen_old_spec/tags/2.5.0/core/module/attr_writer_spec.rb +2 -0
- data/frozen_old_spec/tags/2.5.0/core/module/define_method_spec.rb +1 -0
- data/frozen_old_spec/tags/2.5.0/core/module/remove_method_spec.rb +1 -0
- data/frozen_old_spec/tags/2.5.0/core/module/undef_method_spec.rb +1 -0
- data/frozen_old_spec/tags/2.5.0/core/nil/dup_spec.rb +1 -0
- data/frozen_old_spec/tags/2.5.0/core/struct/new_spec.rb +1 -0
- data/lib/backports/2.5.0.rb +3 -0
- data/lib/backports/2.5.0/array.rb +3 -0
- data/lib/backports/2.5.0/array/append.rb +3 -0
- data/lib/backports/2.5.0/array/prepend.rb +3 -0
- data/lib/backports/2.5.0/dir.rb +3 -0
- data/lib/backports/2.5.0/dir/children.rb +6 -0
- data/lib/backports/2.5.0/dir/each_child.rb +7 -0
- data/lib/backports/2.5.0/enumerable.rb +3 -0
- data/lib/backports/2.5.0/enumerable/all.rb +13 -0
- data/lib/backports/2.5.0/enumerable/any.rb +42 -0
- data/lib/backports/2.5.0/enumerable/none.rb +15 -0
- data/lib/backports/2.5.0/enumerable/one.rb +21 -0
- data/lib/backports/2.5.0/hash.rb +3 -0
- data/lib/backports/2.5.0/hash/slice.rb +7 -0
- data/lib/backports/2.5.0/hash/transform_keys.rb +19 -0
- data/lib/backports/2.5.0/integer.rb +3 -0
- data/lib/backports/2.5.0/integer/allbits.rb +8 -0
- data/lib/backports/2.5.0/integer/anybits.rb +8 -0
- data/lib/backports/2.5.0/integer/nobits.rb +8 -0
- data/lib/backports/2.5.0/integer/sqrt.rb +18 -0
- data/lib/backports/2.5.0/kernel.rb +3 -0
- data/lib/backports/2.5.0/kernel/yield_self.rb +6 -0
- data/lib/backports/2.5.0/module.rb +3 -0
- data/lib/backports/2.5.0/module/alias_method.rb +4 -0
- data/lib/backports/2.5.0/module/attr.rb +3 -0
- data/lib/backports/2.5.0/module/attr_accessor.rb +3 -0
- data/lib/backports/2.5.0/module/attr_reader.rb +3 -0
- data/lib/backports/2.5.0/module/attr_writer.rb +3 -0
- data/lib/backports/2.5.0/module/define_method.rb +3 -0
- data/lib/backports/2.5.0/module/remove_method.rb +3 -0
- data/lib/backports/2.5.0/module/undef_method.rb +3 -0
- data/lib/backports/2.5.0/string.rb +3 -0
- data/lib/backports/2.5.0/string/delete_prefix.rb +32 -0
- data/lib/backports/2.5.0/string/delete_suffix.rb +33 -0
- data/lib/backports/2.5.0/struct.rb +3 -0
- data/lib/backports/2.5.0/struct/new.rb +24 -0
- data/lib/backports/2.5.rb +2 -0
- data/lib/backports/latest.rb +2 -0
- data/lib/backports/version.rb +1 -1
- data/set_version/2.5.0.rb +1 -0
- data/set_version/setter.rb +8 -0
- data/spec/tags/1.9.1/core/dir/each_child_spec.rb +1 -0
- data/spec/tags/1.9.1/core/hash/transform_keys_spec.rb +2 -0
- data/spec/tags/1.9.1/core/io/write_spec.rb +1 -0
- data/spec/tags/1.9.1/core/kernel/yield_self_spec.rb +1 -0
- data/spec/tags/1.9.1/core/method/curry_spec.rb +1 -0
- data/spec/tags/1.9.1/core/module/alias_method_spec.rb +3 -0
- data/spec/tags/1.9.1/core/module/attr_accessor_spec.rb +1 -0
- data/spec/tags/1.9.1/core/module/attr_reader_spec.rb +1 -0
- data/spec/tags/1.9.1/core/module/attr_writer_spec.rb +1 -0
- data/spec/tags/1.9.1/core/module/define_method_spec.rb +7 -0
- data/spec/tags/1.9.1/core/struct/new_spec.rb +2 -0
- data/spec/tags/1.9.2/core/dir/each_child_spec.rb +1 -0
- data/spec/tags/1.9.2/core/hash/transform_keys_spec.rb +2 -0
- data/spec/tags/1.9.2/core/kernel/yield_self_spec.rb +1 -0
- data/spec/tags/1.9.2/core/module/alias_method_spec.rb +3 -0
- data/spec/tags/1.9.2/core/module/attr_accessor_spec.rb +1 -0
- data/spec/tags/1.9.2/core/module/attr_reader_spec.rb +1 -0
- data/spec/tags/1.9.2/core/module/attr_writer_spec.rb +1 -0
- data/spec/tags/1.9.2/core/module/define_method_spec.rb +7 -0
- data/spec/tags/1.9.2/core/struct/new_spec.rb +2 -0
- data/spec/tags/1.9.3/core/dir/each_child_spec.rb +1 -0
- data/spec/tags/1.9.3/core/hash/transform_keys_spec.rb +2 -0
- data/spec/tags/1.9.3/core/hash/transform_values_spec.rb +2 -0
- data/spec/tags/1.9.3/core/kernel/yield_self_spec.rb +1 -0
- data/spec/tags/1.9.3/core/module/alias_method_spec.rb +3 -0
- data/spec/tags/1.9.3/core/module/attr_accessor_spec.rb +1 -0
- data/spec/tags/1.9.3/core/module/attr_reader_spec.rb +1 -0
- data/spec/tags/1.9.3/core/module/attr_writer_spec.rb +1 -0
- data/spec/tags/1.9.3/core/module/define_method_spec.rb +7 -0
- data/spec/tags/1.9.3/core/struct/new_spec.rb +2 -0
- data/spec/tags/2.0.0/core/module/attr_accessor_spec.rb +1 -0
- data/spec/tags/2.0.0/core/module/attr_reader_spec.rb +1 -0
- data/spec/tags/2.0.0/core/module/attr_writer_spec.rb +1 -0
- data/spec/tags/2.0.0/core/module/define_method_spec.rb +4 -0
- data/spec/tags/2.0.0/core/struct/new_spec.rb +1 -0
- data/spec/tags/2.1.0/core/module/attr_accessor_spec.rb +1 -0
- data/spec/tags/2.1.0/core/module/attr_reader_spec.rb +1 -0
- data/spec/tags/2.1.0/core/module/attr_writer_spec.rb +1 -0
- data/spec/tags/2.1.0/core/module/define_method_spec.rb +4 -0
- data/spec/tags/2.1.0/core/struct/new_spec.rb +1 -0
- data/spec/tags/2.2.0/core/module/attr_accessor_spec.rb +1 -0
- data/spec/tags/2.2.0/core/module/attr_reader_spec.rb +1 -0
- data/spec/tags/2.2.0/core/module/attr_writer_spec.rb +1 -0
- data/spec/tags/2.2.0/core/module/define_method_spec.rb +4 -0
- data/spec/tags/2.2.0/core/struct/new_spec.rb +1 -0
- data/spec/tags/2.3.0/core/struct/new_spec.rb +1 -0
- data/spec/tags/2.4.0/core/struct/new_spec.rb +1 -0
- metadata +265 -10
checksums.yaml
CHANGED
@@ -1,7 +1,15 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
ODk0MDdiZjY0ZmNhZDFkMDI1YzZkOWVjMWQwNDUwZmVhODc4ZjYzNw==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
YmM4MTg3NWQzZjVkNjUxZTIzYWRlZDUyYjYwNTU1ZTRhMzc1MTM5MA==
|
5
7
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
MTI2YjA0MTRmMGNmOGRhNjcyMTQzYWJkZWU0OGZkODRkYmNkODU1MzI3NzNj
|
10
|
+
MjE2ZWVkYjI2NTZmYzJiOGE0N2UzMjk0Y2U4Yzg5MDI0NTk5MTlkNWNjMTZi
|
11
|
+
NmIzODk5MmRhYTcxYmNjNDlmNTdiOTkyMzczYjc5MjUyMmFjZmM=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
YjFkZWJhNzFlZjc0YjE5YWIzMDFmNmE1YmNhMGE1MGE3YjE4ODUwOTNlMjYz
|
14
|
+
NDc4YmQ1MmU0OTM5NDViMGFiZDk3MjY5M2I0NTMxN2Q0ZjVjNmEyYjgxNWUz
|
15
|
+
ZmY5OTlkYzU0MjM1ZmZhZTIyMjlkNWVlZWNjODBmMzAzMTdmMDE=
|
data/.travis.yml
CHANGED
@@ -10,9 +10,9 @@ rvm:
|
|
10
10
|
- "2.4.0"
|
11
11
|
- ruby-head
|
12
12
|
|
13
|
-
matrix:
|
14
|
-
|
15
|
-
|
13
|
+
# matrix:
|
14
|
+
# allow_failures:
|
15
|
+
# - rvm: "2.2.0" # Travis suddenly fails to `bundle install`, no idea why
|
16
16
|
|
17
17
|
before_install:
|
18
18
|
- git submodule update --init --recursive
|
data/README.rdoc
CHANGED
@@ -8,6 +8,10 @@ This gem is for you!
|
|
8
8
|
|
9
9
|
The goal of 'backports' is to make it easier to write ruby code that runs across different versions of Ruby.
|
10
10
|
|
11
|
+
== Loading backports
|
12
|
+
|
13
|
+
=== Explicitly (recommended)
|
14
|
+
|
11
15
|
For example, if you want to use flat_map, even in Ruby implementations that don't include it, as well as the new bsearch method:
|
12
16
|
|
13
17
|
require 'backports/1.9.2/enumerable/flat_map'
|
@@ -15,11 +19,23 @@ For example, if you want to use flat_map, even in Ruby implementations that don'
|
|
15
19
|
|
16
20
|
This will enable Enumerable#flat_map and Array#bsearch, using the native versions if available or otherwise provide a pure Ruby version.
|
17
21
|
|
18
|
-
|
22
|
+
=== By Module
|
23
|
+
|
24
|
+
To bring all the backports for a given Class/Module, you can specify only that Class:
|
25
|
+
|
26
|
+
require 'backports/2.3.0/hash'
|
27
|
+
|
28
|
+
This will make sure that Hash responds to dig, fetch_values, <, <=, >, >= and to_proc
|
29
|
+
|
30
|
+
=== Up to a specific Ruby version
|
19
31
|
|
20
|
-
|
32
|
+
You can load all backports up to a specific version. For example, to bring any version of Ruby mostly up to Ruby 2.4.0's standards:
|
21
33
|
|
22
|
-
|
34
|
+
require 'backports/2.4.0'
|
35
|
+
|
36
|
+
This will bring in all the features of 1.8.7 and many features of Ruby 1.9.x all the way up to Ruby 2.4.0 (for all versions of Ruby)!
|
37
|
+
|
38
|
+
While it is not recommended, you may `require 'backports/latest'` as a shortcut to the latest Ruby version supported. This is equivalent to the deprecated `require 'backports'`.
|
23
39
|
|
24
40
|
+Note+: Although I am a Ruby committer, this gem is a personal project and is not endorsed by ruby-core.
|
25
41
|
|
@@ -30,13 +46,9 @@ Goals for backported features:
|
|
30
46
|
2. Pure Ruby (no C extensions)
|
31
47
|
3. Pass ruby/spec[https://github.com/ruby/spec]
|
32
48
|
|
33
|
-
Let's be a bit more precise about the "breaking code" business. It is of course entirely possible that code will break,
|
34
|
-
|
35
|
-
A real incompatibility is, for example, <tt>Module::instance_methods</tt> which returns strings in 1.8 and symbols in 1.9. No change can be made without the risk of breaking existing code. Such incompatibilities are left unchanged, although you can require some of these changes in addition (see below)
|
49
|
+
Let's be a bit more precise about the "breaking code" business. It is of course entirely possible that code will break. In particular, you may be distinguishing parameters with duck typing, but a builtin class may, in the future, be responding to a particular call. Here's [an exemple from Rails](https://github.com/rails/rails/blob/a4b55827721a5967299f3c1531afb3d6d81e4ac0/activerecord/lib/active_record/associations/association.rb#L155-L159) that is relying on the fact that Proc and Method respond to :to_proc and Hash isn't. That is, until Ruby 2.3... This old version of Rails therefore won't work on Ruby 2.3, or on older Rubies with that the `2.3.0/hash/to_proc` loaded...
|
36
50
|
|
37
|
-
|
38
|
-
|
39
|
-
For historical reasons, some generic and self-contained features of active-support are also included. By simple I mean that String#camelcase is there, but #pluralize isn't. These will probably be removed in the future, so it's recommended to require those directly from active_support.
|
51
|
+
For Ruby < 2.0, there are some real incompatibilities. For example, <tt>Module::instance_methods</tt> which returns strings in 1.8 and symbols in 1.9. No change can be made without the risk of breaking existing code. Such incompatibilities are left unchanged, although you can require some of these changes in addition (see below).
|
40
52
|
|
41
53
|
== Installation & compatibility
|
42
54
|
|
@@ -54,9 +66,6 @@ To use:
|
|
54
66
|
# For all backports up to a given version
|
55
67
|
require 'backports/1.9.2' # All backports for Ruby 1.9.2 and below
|
56
68
|
|
57
|
-
# Or for all backports
|
58
|
-
require 'backports'
|
59
|
-
|
60
69
|
Note: about a dozen of backports have a dependency that will be also loaded. For example, the backport of Enumerable#flat_map uses flatten(1), so if required from Ruby 1.8.6 (where Array#flatten does not accept an argument), the backport for Ruby's 1.8.7 flatten with an argument will also be loaded.
|
61
70
|
|
62
71
|
With bundler, add to your Gemfile:
|
@@ -68,6 +77,31 @@ Compatible with Ruby itself, JRuby and Rubinius.
|
|
68
77
|
|
69
78
|
= Complete List of backports
|
70
79
|
|
80
|
+
== Ruby 2.5 backports
|
81
|
+
|
82
|
+
* Array
|
83
|
+
* +append+, +prepend+
|
84
|
+
* Dir
|
85
|
+
* +children+, +each_child+
|
86
|
+
* Enumerable
|
87
|
+
* +any?+, +all?+, +none?+, +one?+ (with pattern argument)
|
88
|
+
* Hash
|
89
|
+
* +slice+
|
90
|
+
* +transform_keys+
|
91
|
+
* Integer
|
92
|
+
* +sqrt+
|
93
|
+
* +allbits?+, +anybits?+ and +nobits?+
|
94
|
+
* Kernel
|
95
|
+
* +yield_self+
|
96
|
+
* Module
|
97
|
+
* +attr+, +attr_accessor+, +attr_reader+, +attr_writer+ (now public)
|
98
|
+
* +define_method+, +alias_method+, +undef_method+, +remove_method+ (now public)
|
99
|
+
* String
|
100
|
+
* +delete_prefix+, +delete_prefix!+
|
101
|
+
* +delete_suffix+, +delete_suffix!+
|
102
|
+
* Struct
|
103
|
+
* +new+ (with <code>keyword_init: true</code>)
|
104
|
+
|
71
105
|
== Ruby 2.4 backports
|
72
106
|
|
73
107
|
* Comparable
|
@@ -314,7 +348,7 @@ I am aware of the following backport gem, which probably won't make it into this
|
|
314
348
|
|
315
349
|
* Net::SMTP for Ruby 1.8.6: smtp_tls[http://seattlerb.rubyforge.org/smtp_tls/]
|
316
350
|
|
317
|
-
Requiring
|
351
|
+
Requiring backports for a given version of Ruby will also load 'backports/std_lib'.
|
318
352
|
|
319
353
|
== Forcing incompatibilities
|
320
354
|
|
data/Rakefile
CHANGED
@@ -121,12 +121,22 @@ OLD_IGNORE_IN_18 = %w[
|
|
121
121
|
1.9.1/proc/case_compare
|
122
122
|
2.4.0/string/match
|
123
123
|
2.4.0/regexp/match
|
124
|
+
2.5.0/module/define_method
|
124
125
|
]
|
125
126
|
# These **new** specs cause actual errors while loading in 1.9:
|
126
127
|
IGNORE_IN_19 = %w[
|
127
128
|
2.1.0/enumerable/to_h
|
128
129
|
2.1.0/array/to_h
|
129
130
|
2.1.0/module/include
|
131
|
+
2.5.0/module/define_method
|
132
|
+
2.5.0/module/alias_method
|
133
|
+
2.5.0/module/undef_method
|
134
|
+
2.5.0/module/remove_method
|
135
|
+
2.5.0/module/attr
|
136
|
+
2.5.0/module/attr_reader
|
137
|
+
2.5.0/module/attr_writer
|
138
|
+
2.5.0/module/attr_accessor
|
139
|
+
2.5.0/struct/new
|
130
140
|
]
|
131
141
|
# These **new** specs cause actual errors while loading in 2.0.0:
|
132
142
|
IGNORE_IN_200 = %w[
|
@@ -0,0 +1 @@
|
|
1
|
+
fails:Array#<< raises a RuntimeError on a frozen array
|
@@ -0,0 +1 @@
|
|
1
|
+
fails:Enumerable#all? with block gathers initial args as elements when each yields multiple
|
@@ -0,0 +1 @@
|
|
1
|
+
fails:Enumerable#none? with a block gathers initial args as elements when each yields multiple
|
@@ -0,0 +1 @@
|
|
1
|
+
fails:Enumerable#one? when passed a block gathers initial args as elements when each yields multiple
|
@@ -0,0 +1 @@
|
|
1
|
+
fails:Module#alias_method is a private method
|
@@ -0,0 +1 @@
|
|
1
|
+
fails:Module#attr is a private method
|
@@ -0,0 +1 @@
|
|
1
|
+
fails:Module#define_method is private
|
@@ -0,0 +1 @@
|
|
1
|
+
fails:Module#remove_method is a private method
|
@@ -0,0 +1 @@
|
|
1
|
+
fails:Module#undef_method is a private method
|
@@ -0,0 +1 @@
|
|
1
|
+
fails:Array#<< raises a RuntimeError on a frozen array
|
@@ -0,0 +1 @@
|
|
1
|
+
fails:Enumerable#all? with block gathers initial args as elements when each yields multiple
|
@@ -0,0 +1 @@
|
|
1
|
+
fails:Enumerable#none? with a block gathers initial args as elements when each yields multiple
|
@@ -0,0 +1 @@
|
|
1
|
+
fails:Enumerable#one? when passed a block gathers initial args as elements when each yields multiple
|
@@ -0,0 +1,7 @@
|
|
1
|
+
fails:Module#alias_method raises RuntimeError if frozen
|
2
|
+
fails:Module#alias_method is a private method
|
3
|
+
fails:Module#alias_method aliasing special methods keeps initialize private when aliasing
|
4
|
+
fails:Module#alias_method aliasing special methods keeps initialize_copy private when aliasing
|
5
|
+
fails:Module#alias_method aliasing special methods keeps initialize_clone private when aliasing
|
6
|
+
fails:Module#alias_method aliasing special methods keeps initialize_dup private when aliasing
|
7
|
+
fails:Module#alias_method aliasing special methods keeps respond_to_missing? private when aliasing
|
@@ -0,0 +1 @@
|
|
1
|
+
fails:Module#define_method is private
|
@@ -0,0 +1 @@
|
|
1
|
+
fails:Array#<< raises a RuntimeError on a frozen array
|
@@ -0,0 +1 @@
|
|
1
|
+
fails:Enumerable#all? with block gathers initial args as elements when each yields multiple
|
@@ -0,0 +1 @@
|
|
1
|
+
fails:Enumerable#none? with a block gathers initial args as elements when each yields multiple
|
@@ -0,0 +1 @@
|
|
1
|
+
fails:Enumerable#one? when passed a block gathers initial args as elements when each yields multiple
|
@@ -0,0 +1,4 @@
|
|
1
|
+
fails:Module#alias_method is a private method
|
2
|
+
fails:Module#alias_method aliasing special methods keeps initialize_clone private when aliasing
|
3
|
+
fails:Module#alias_method aliasing special methods keeps initialize_dup private when aliasing
|
4
|
+
fails:Module#alias_method aliasing special methods keeps respond_to_missing? private when aliasing
|
@@ -0,0 +1 @@
|
|
1
|
+
fails:Module#attr is a private method
|
@@ -0,0 +1 @@
|
|
1
|
+
fails:Module#remove_method is a private method
|
@@ -0,0 +1 @@
|
|
1
|
+
fails:Module#undef_method is a private method
|
@@ -0,0 +1 @@
|
|
1
|
+
fails:Array#<< raises a RuntimeError on a frozen array
|
@@ -0,0 +1 @@
|
|
1
|
+
fails:Enumerable#all? with block gathers initial args as elements when each yields multiple
|
@@ -0,0 +1 @@
|
|
1
|
+
fails:Enumerable#none? with a block gathers initial args as elements when each yields multiple
|
@@ -0,0 +1 @@
|
|
1
|
+
fails:Enumerable#one? when passed a block gathers initial args as elements when each yields multiple
|
@@ -0,0 +1,4 @@
|
|
1
|
+
fails:Module#alias_method is a private method
|
2
|
+
fails:Module#alias_method aliasing special methods keeps initialize_clone private when aliasing
|
3
|
+
fails:Module#alias_method aliasing special methods keeps initialize_dup private when aliasing
|
4
|
+
fails:Module#alias_method aliasing special methods keeps respond_to_missing? private when aliasing
|
@@ -0,0 +1 @@
|
|
1
|
+
fails:Module#attr is a private method
|
@@ -0,0 +1 @@
|
|
1
|
+
fails:Module#remove_method is a private method
|
@@ -0,0 +1 @@
|
|
1
|
+
fails:Module#undef_method is a private method
|
@@ -0,0 +1 @@
|
|
1
|
+
fails:Enumerable#any? raises an ArgumentError when any arguments provided
|
@@ -0,0 +1,4 @@
|
|
1
|
+
fails:Module#alias_method is a private method
|
2
|
+
fails:Module#alias_method aliasing special methods keeps initialize_clone private when aliasing
|
3
|
+
fails:Module#alias_method aliasing special methods keeps initialize_dup private when aliasing
|
4
|
+
fails:Module#alias_method aliasing special methods keeps respond_to_missing? private when aliasing
|
@@ -0,0 +1 @@
|
|
1
|
+
fails:Module#attr_accessor is a private method
|
@@ -0,0 +1 @@
|
|
1
|
+
fails:Module#attr_reader is a private method
|
@@ -0,0 +1 @@
|
|
1
|
+
fails:Module#attr is a private method
|
@@ -0,0 +1 @@
|
|
1
|
+
fails:Module#attr_writer is a private method
|
@@ -0,0 +1 @@
|
|
1
|
+
fails:Module#remove_method is a private method
|
@@ -0,0 +1 @@
|
|
1
|
+
fails:Module#undef_method is a private method
|
@@ -0,0 +1 @@
|
|
1
|
+
fails:Enumerable#any? raises an ArgumentError when any arguments provided
|
@@ -0,0 +1 @@
|
|
1
|
+
fails:Module#alias_method is a private method
|
@@ -0,0 +1 @@
|
|
1
|
+
fails:Module#attr is a private method
|
@@ -0,0 +1 @@
|
|
1
|
+
fails:Module#remove_method is a private method
|
@@ -0,0 +1 @@
|
|
1
|
+
fails:Module#undef_method is a private method
|
@@ -0,0 +1 @@
|
|
1
|
+
fails:Struct.new raises a TypeError if object doesn't respond to to_sym
|
@@ -0,0 +1 @@
|
|
1
|
+
fails:Enumerable#any? raises an ArgumentError when any arguments provided
|
@@ -0,0 +1 @@
|
|
1
|
+
fails:Module#alias_method is a private method
|
@@ -0,0 +1 @@
|
|
1
|
+
fails:Module#attr is a private method
|