backports 3.15.0 → 3.24.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +846 -0
- data/Gemfile +6 -13
- data/README.md +706 -0
- data/SECURITY.md +5 -0
- data/backports.gemspec +6 -2
- data/lib/backports/1.8.7.rb +10 -2
- data/lib/backports/1.9.1.rb +6 -1
- data/lib/backports/1.9.2/stdlib/matrix.rb +5 -0
- data/lib/backports/1.9.2.rb +6 -1
- data/lib/backports/1.9.3.rb +6 -1
- data/lib/backports/2.0.0/range/size.rb +2 -0
- data/lib/backports/2.0.0.rb +7 -2
- data/lib/backports/2.1.0/module/singleton_class.rb +8 -0
- data/lib/backports/2.1.0.rb +2 -2
- data/lib/backports/2.2.0/enumerable/slice_after.rb +1 -1
- data/lib/backports/2.2.0/float/next_float.rb +1 -1
- data/lib/backports/2.2.0/float/prev_float.rb +1 -1
- data/lib/backports/2.2.0/method/super_method.rb +2 -2
- data/lib/backports/2.2.0/string/unicode_normalize.rb +3 -3
- data/lib/backports/2.2.0.rb +2 -2
- data/lib/backports/2.3.0/array/bsearch_index.rb +1 -1
- data/lib/backports/2.3.0/hash/lt.rb +1 -1
- data/lib/backports/2.3.0/hash/lte.rb +1 -1
- data/lib/backports/2.3.0/hash/to_proc.rb +1 -1
- data/lib/backports/2.3.0/queue/close.rb +48 -0
- data/lib/backports/2.3.0/string.rb +3 -0
- data/lib/backports/2.3.0/struct/dig.rb +3 -2
- data/lib/backports/2.3.0.rb +2 -2
- data/lib/backports/2.4.0/bignum/dup.rb +5 -0
- data/lib/backports/2.4.0/bignum.rb +3 -0
- data/lib/backports/2.4.0/enumerable/sum.rb +8 -4
- data/lib/backports/2.4.0/hash/transform_values.rb +2 -2
- data/lib/backports/2.4.0/string/unpack1.rb +7 -0
- data/lib/backports/2.4.0/true_class/dup.rb +0 -1
- data/lib/backports/2.4.0.rb +2 -2
- data/lib/backports/2.5.0/dir/children.rb +4 -0
- data/lib/backports/2.5.0/dir/each_child.rb +7 -0
- data/lib/backports/2.5.0/hash/transform_keys.rb +11 -4
- data/lib/backports/2.5.0/integer/sqrt.rb +2 -2
- data/lib/backports/2.5.0/module/alias_method.rb +0 -1
- data/lib/backports/2.5.0/string/undump.rb +5 -9
- data/lib/backports/2.5.0/struct/new.rb +1 -1
- data/lib/backports/2.5.0.rb +2 -2
- data/lib/backports/2.5.rb +1 -1
- data/lib/backports/2.6.0/array/difference.rb +7 -3
- data/lib/backports/2.6.0/enumerable/chain.rb +6 -1
- data/lib/backports/2.6.0/hash/to_h.rb +1 -1
- data/lib/backports/2.6.0/range/cover.rb +22 -0
- data/lib/backports/2.6.0/range.rb +3 -0
- data/lib/backports/2.6.0.rb +3 -3
- data/lib/backports/2.6.rb +1 -1
- data/lib/backports/2.7.0/array/intersection.rb +7 -0
- data/lib/backports/2.7.0/array.rb +3 -0
- data/lib/backports/2.7.0/comparable/clamp.rb +23 -0
- data/lib/backports/2.7.0/comparable.rb +3 -0
- data/lib/backports/2.7.0/complex/comparison.rb +13 -0
- data/lib/backports/2.7.0/complex.rb +3 -0
- data/lib/backports/2.7.0/enumerable/filter_map.rb +14 -0
- data/lib/backports/2.7.0/enumerable/tally.rb +11 -0
- data/lib/backports/2.7.0/enumerable.rb +3 -0
- data/lib/backports/2.7.0/enumerator/produce.rb +20 -0
- data/lib/backports/2.7.0/enumerator.rb +3 -0
- data/lib/backports/2.7.0/symbol/end_with.rb +9 -0
- data/lib/backports/2.7.0/symbol/start_with.rb +9 -0
- data/lib/backports/2.7.0/symbol.rb +3 -0
- data/lib/backports/2.7.0/time/ceil.rb +10 -0
- data/lib/backports/2.7.0/time/floor.rb +7 -0
- data/lib/backports/2.7.0.rb +3 -0
- data/lib/backports/2.7.rb +1 -0
- data/lib/backports/3.0.0/env/except.rb +10 -0
- data/lib/backports/3.0.0/env.rb +3 -0
- data/lib/backports/3.0.0/hash/except.rb +10 -0
- data/lib/backports/3.0.0/hash/transform_keys.rb +48 -0
- data/lib/backports/3.0.0/hash.rb +3 -0
- data/lib/backports/3.0.0/ractor.rb +19 -0
- data/lib/backports/3.0.0/symbol/name.rb +21 -0
- data/lib/backports/3.0.0/symbol.rb +3 -0
- data/lib/backports/3.0.0.rb +3 -0
- data/lib/backports/3.0.rb +1 -0
- data/lib/backports/3.1.0/array/intersect.rb +16 -0
- data/lib/backports/3.1.0/array.rb +3 -0
- data/lib/backports/3.1.0/class/subclasses.rb +11 -0
- data/lib/backports/3.1.0/enumerable/compact.rb +5 -0
- data/lib/backports/3.1.0/enumerable/tally.rb +18 -0
- data/lib/backports/3.1.0/enumerable.rb +3 -0
- data/lib/backports/3.1.0/file/dirname.rb +16 -0
- data/lib/backports/3.1.0/file.rb +3 -0
- data/lib/backports/3.1.0/integer/try_convert.rb +7 -0
- data/lib/backports/3.1.0/integer.rb +3 -0
- data/lib/backports/3.1.0/match_data/match.rb +5 -0
- data/lib/backports/3.1.0/match_data/match_length.rb +6 -0
- data/lib/backports/3.1.0/match_data.rb +3 -0
- data/lib/backports/3.1.0/struct/keyword_init.rb +5 -0
- data/lib/backports/3.1.0/struct.rb +3 -0
- data/lib/backports/3.1.0.rb +3 -0
- data/lib/backports/3.1.rb +1 -0
- data/lib/backports/3.2.0/class/attached_object.rb +10 -0
- data/lib/backports/3.2.0/class.rb +3 -0
- data/lib/backports/3.2.0/data.rb +144 -0
- data/lib/backports/3.2.0/enumerator/product.rb +64 -0
- data/lib/backports/3.2.0/enumerator.rb +3 -0
- data/lib/backports/3.2.0/hash/shift.rb +10 -0
- data/lib/backports/3.2.0/hash.rb +3 -0
- data/lib/backports/3.2.0/integer/ceildiv.rb +7 -0
- data/lib/backports/3.2.0/integer.rb +3 -0
- data/lib/backports/3.2.0/match_data/byteoffset.rb +12 -0
- data/lib/backports/3.2.0/match_data.rb +3 -0
- data/lib/backports/3.2.0.rb +3 -0
- data/lib/backports/3.2.rb +1 -0
- data/lib/backports/latest.rb +1 -1
- data/lib/backports/ractor/cloner.rb +103 -0
- data/lib/backports/ractor/errors.rb +20 -0
- data/lib/backports/ractor/filtered_queue.rb +205 -0
- data/lib/backports/ractor/queues.rb +66 -0
- data/lib/backports/ractor/ractor.rb +272 -0
- data/lib/backports/ractor/sharing.rb +97 -0
- data/lib/backports/rails/array.rb +4 -0
- data/lib/backports/rails/enumerable.rb +4 -0
- data/lib/backports/rails/hash.rb +4 -0
- data/lib/backports/rails/kernel.rb +4 -0
- data/lib/backports/rails/module.rb +4 -0
- data/lib/backports/rails/string.rb +4 -0
- data/lib/backports/std_lib.rb +3 -0
- data/lib/backports/tools/deprecation.rb +19 -0
- data/lib/backports/tools/require_relative_dir.rb +6 -1
- data/lib/backports/version.rb +1 -1
- data/lib/backports.rb +6 -0
- metadata +81 -488
- data/.document +0 -6
- data/.gitignore +0 -9
- data/.gitmodules +0 -6
- data/.irbrc +0 -3
- data/.travis.yml +0 -20
- data/CHANGELOG.rdoc +0 -479
- data/README.rdoc +0 -422
- data/Rakefile +0 -189
- data/default.mspec +0 -14
- data/frozen_old_spec/tags/1.8.6/core/argf/each_line_spec.rb +0 -6
- data/frozen_old_spec/tags/1.8.6/core/argf/each_spec.rb +0 -6
- data/frozen_old_spec/tags/1.8.6/core/argf/lines_spec.rb +0 -6
- data/frozen_old_spec/tags/1.8.6/core/array/append_spec.rb +0 -1
- data/frozen_old_spec/tags/1.8.6/core/array/collect_spec.rb +0 -7
- data/frozen_old_spec/tags/1.8.6/core/array/rotate_spec.rb +0 -2
- data/frozen_old_spec/tags/1.8.6/core/array/uniq_spec.rb +0 -3
- data/frozen_old_spec/tags/1.8.6/core/complex/to_r_spec.rb +0 -3
- data/frozen_old_spec/tags/1.8.6/core/enumerable/all_spec.rb +0 -1
- data/frozen_old_spec/tags/1.8.6/core/enumerable/any_spec.rb +0 -2
- data/frozen_old_spec/tags/1.8.6/core/enumerable/each_entry_spec.rb +0 -1
- data/frozen_old_spec/tags/1.8.6/core/enumerable/none_spec.rb +0 -1
- data/frozen_old_spec/tags/1.8.6/core/enumerable/one_spec.rb +0 -1
- data/frozen_old_spec/tags/1.8.6/core/enumerator/next_spec.rb +0 -1
- data/frozen_old_spec/tags/1.8.6/core/env/to_h_spec.rb +0 -2
- data/frozen_old_spec/tags/1.8.6/core/file/join_spec.rb +0 -3
- data/frozen_old_spec/tags/1.8.6/core/file/lchmod_spec.rb +0 -2
- data/frozen_old_spec/tags/1.8.6/core/file/new_spec.rb +0 -2
- data/frozen_old_spec/tags/1.8.6/core/file/open_spec.rb +0 -13
- data/frozen_old_spec/tags/1.8.6/core/file/to_path_spec.rb +0 -1
- data/frozen_old_spec/tags/1.8.6/core/fixnum/fdiv_spec.rb +0 -1
- data/frozen_old_spec/tags/1.8.6/core/gc/stress_spec.rb +0 -2
- data/frozen_old_spec/tags/1.8.6/core/hash/assoc_spec.rb +0 -1
- data/frozen_old_spec/tags/1.8.6/core/hash/constructor_spec.rb +0 -3
- data/frozen_old_spec/tags/1.8.6/core/hash/default_proc_spec.rb +0 -3
- data/frozen_old_spec/tags/1.8.6/core/hash/delete_if_spec.rb +0 -1
- data/frozen_old_spec/tags/1.8.6/core/hash/each_pair_spec.rb +0 -1
- data/frozen_old_spec/tags/1.8.6/core/hash/eql_spec.rb +0 -3
- data/frozen_old_spec/tags/1.8.6/core/hash/hash_spec.rb +0 -3
- data/frozen_old_spec/tags/1.8.6/core/hash/keep_if_spec.rb +0 -2
- data/frozen_old_spec/tags/1.8.6/core/hash/rassoc_spec.rb +0 -1
- data/frozen_old_spec/tags/1.8.6/core/hash/reject_spec.rb +0 -2
- data/frozen_old_spec/tags/1.8.6/core/hash/select_spec.rb +0 -8
- data/frozen_old_spec/tags/1.8.6/core/integer/round_spec.rb +0 -2
- data/frozen_old_spec/tags/1.8.6/core/io/binread_spec.rb +0 -7
- data/frozen_old_spec/tags/1.8.6/core/io/chars_spec.rb +0 -1
- data/frozen_old_spec/tags/1.8.6/core/io/each_char_spec.rb +0 -1
- data/frozen_old_spec/tags/1.8.6/core/io/lines_spec.rb +0 -1
- data/frozen_old_spec/tags/1.8.6/core/io/open_spec.rb +0 -24
- data/frozen_old_spec/tags/1.8.6/core/io/ungetbyte_spec.rb +0 -4
- data/frozen_old_spec/tags/1.8.6/core/io/write_spec.rb +0 -5
- data/frozen_old_spec/tags/1.8.6/core/kernel/__callee___spec.rb +0 -6
- data/frozen_old_spec/tags/1.8.6/core/kernel/__method___spec.rb +0 -1
- data/frozen_old_spec/tags/1.8.6/core/kernel/define_singleton_method_spec.rb +0 -2
- data/frozen_old_spec/tags/1.8.6/core/kernel/public_method_spec.rb +0 -2
- data/frozen_old_spec/tags/1.8.6/core/kernel/require_relative_spec.rb +0 -3
- data/frozen_old_spec/tags/1.8.6/core/math/log2_spec.rb +0 -6
- data/frozen_old_spec/tags/1.8.6/core/math/log_spec.rb +0 -3
- data/frozen_old_spec/tags/1.8.6/core/module/alias_method_spec.rb +0 -1
- data/frozen_old_spec/tags/1.8.6/core/module/attr_accessor_spec.rb +0 -2
- data/frozen_old_spec/tags/1.8.6/core/module/attr_reader_spec.rb +0 -2
- data/frozen_old_spec/tags/1.8.6/core/module/attr_spec.rb +0 -1
- data/frozen_old_spec/tags/1.8.6/core/module/attr_writer_spec.rb +0 -2
- data/frozen_old_spec/tags/1.8.6/core/module/class_exec_spec.rb +0 -2
- data/frozen_old_spec/tags/1.8.6/core/module/define_method_spec.rb +0 -1
- data/frozen_old_spec/tags/1.8.6/core/module/module_exec_spec.rb +0 -2
- data/frozen_old_spec/tags/1.8.6/core/module/remove_method_spec.rb +0 -1
- data/frozen_old_spec/tags/1.8.6/core/module/undef_method_spec.rb +0 -1
- data/frozen_old_spec/tags/1.8.6/core/nil/dup_spec.rb +0 -1
- data/frozen_old_spec/tags/1.8.6/core/numeric/step_spec.rb +0 -12
- data/frozen_old_spec/tags/1.8.6/core/proc/curry_spec.rb +0 -4
- data/frozen_old_spec/tags/1.8.6/core/range/step_spec.rb +0 -12
- data/frozen_old_spec/tags/1.8.6/core/string/getbyte_spec.rb +0 -6
- data/frozen_old_spec/tags/1.8.6/core/string/partition_spec.rb +0 -1
- data/frozen_old_spec/tags/1.8.6/core/string/prepend_spec.rb +0 -1
- data/frozen_old_spec/tags/1.8.6/core/string/rpartition_spec.rb +0 -1
- data/frozen_old_spec/tags/1.8.6/core/string/setbyte_spec.rb +0 -5
- data/frozen_old_spec/tags/1.8.6/core/string/upto_spec.rb +0 -1
- data/frozen_old_spec/tags/1.8.6/core/symbol/capitalize_spec.rb +0 -3
- data/frozen_old_spec/tags/1.8.6/core/symbol/comparison_spec.rb +0 -1
- data/frozen_old_spec/tags/1.8.6/core/symbol/downcase_spec.rb +0 -2
- data/frozen_old_spec/tags/1.8.6/core/symbol/element_reference_spec.rb +0 -4
- data/frozen_old_spec/tags/1.8.6/core/symbol/empty_spec.rb +0 -1
- data/frozen_old_spec/tags/1.8.6/core/symbol/match_spec.rb +0 -2
- data/frozen_old_spec/tags/1.8.6/core/symbol/swapcase_spec.rb +0 -2
- data/frozen_old_spec/tags/1.8.6/core/symbol/to_proc_spec.rb +0 -1
- data/frozen_old_spec/tags/1.8.6/core/symbol/upcase_spec.rb +0 -1
- data/frozen_old_spec/tags/1.8.7/core/array/append_spec.rb +0 -1
- data/frozen_old_spec/tags/1.8.7/core/array/keep_if_spec.rb +0 -2
- data/frozen_old_spec/tags/1.8.7/core/array/rotate_spec.rb +0 -2
- data/frozen_old_spec/tags/1.8.7/core/array/select_spec.rb +0 -2
- data/frozen_old_spec/tags/1.8.7/core/array/uniq_spec.rb +0 -3
- data/frozen_old_spec/tags/1.8.7/core/complex/to_r_spec.rb +0 -3
- data/frozen_old_spec/tags/1.8.7/core/enumerable/all_spec.rb +0 -1
- data/frozen_old_spec/tags/1.8.7/core/enumerable/any_spec.rb +0 -2
- data/frozen_old_spec/tags/1.8.7/core/enumerable/collect_concat_spec.rb +0 -1
- data/frozen_old_spec/tags/1.8.7/core/enumerable/flat_map_spec.rb +0 -1
- data/frozen_old_spec/tags/1.8.7/core/enumerable/none_spec.rb +0 -1
- data/frozen_old_spec/tags/1.8.7/core/enumerable/one_spec.rb +0 -1
- data/frozen_old_spec/tags/1.8.7/core/env/to_h_spec.rb +0 -2
- data/frozen_old_spec/tags/1.8.7/core/file/lchmod_spec.rb +0 -2
- data/frozen_old_spec/tags/1.8.7/core/file/new_spec.rb +0 -1
- data/frozen_old_spec/tags/1.8.7/core/file/open_spec.rb +0 -5
- data/frozen_old_spec/tags/1.8.7/core/file/readlink_spec.rb +0 -6
- data/frozen_old_spec/tags/1.8.7/core/file/to_path_spec.rb +0 -1
- data/frozen_old_spec/tags/1.8.7/core/hash/assoc_spec.rb +0 -1
- data/frozen_old_spec/tags/1.8.7/core/hash/default_proc_spec.rb +0 -3
- data/frozen_old_spec/tags/1.8.7/core/hash/keep_if_spec.rb +0 -2
- data/frozen_old_spec/tags/1.8.7/core/hash/merge_spec.rb +0 -3
- data/frozen_old_spec/tags/1.8.7/core/hash/rassoc_spec.rb +0 -1
- data/frozen_old_spec/tags/1.8.7/core/hash/select_spec.rb +0 -1
- data/frozen_old_spec/tags/1.8.7/core/hash/to_h_spec.rb +0 -1
- data/frozen_old_spec/tags/1.8.7/core/hash/update_spec.rb +0 -3
- data/frozen_old_spec/tags/1.8.7/core/integer/round_spec.rb +0 -2
- data/frozen_old_spec/tags/1.8.7/core/io/binread_spec.rb +0 -7
- data/frozen_old_spec/tags/1.8.7/core/io/open_spec.rb +0 -32
- data/frozen_old_spec/tags/1.8.7/core/io/ungetbyte_spec.rb +0 -4
- data/frozen_old_spec/tags/1.8.7/core/io/write_spec.rb +0 -5
- data/frozen_old_spec/tags/1.8.7/core/kernel/__callee___spec.rb +0 -6
- data/frozen_old_spec/tags/1.8.7/core/kernel/define_singleton_method_spec.rb +0 -2
- data/frozen_old_spec/tags/1.8.7/core/kernel/public_method_spec.rb +0 -1
- data/frozen_old_spec/tags/1.8.7/core/kernel/require_relative_spec.rb +0 -3
- data/frozen_old_spec/tags/1.8.7/core/math/log2_spec.rb +0 -6
- data/frozen_old_spec/tags/1.8.7/core/math/log_spec.rb +0 -3
- data/frozen_old_spec/tags/1.8.7/core/module/alias_method_spec.rb +0 -7
- data/frozen_old_spec/tags/1.8.7/core/module/attr_accessor_spec.rb +0 -2
- data/frozen_old_spec/tags/1.8.7/core/module/attr_reader_spec.rb +0 -2
- data/frozen_old_spec/tags/1.8.7/core/module/attr_spec.rb +0 -2
- data/frozen_old_spec/tags/1.8.7/core/module/attr_writer_spec.rb +0 -2
- data/frozen_old_spec/tags/1.8.7/core/module/define_method_spec.rb +0 -1
- data/frozen_old_spec/tags/1.8.7/core/module/include_spec.rb +0 -3
- data/frozen_old_spec/tags/1.8.7/core/module/remove_method_spec.rb +0 -3
- data/frozen_old_spec/tags/1.8.7/core/module/undef_method_spec.rb +0 -3
- data/frozen_old_spec/tags/1.8.7/core/nil/dup_spec.rb +0 -1
- data/frozen_old_spec/tags/1.8.7/core/proc/curry_spec.rb +0 -3
- data/frozen_old_spec/tags/1.8.7/core/proc/yield_spec.rb +0 -4
- data/frozen_old_spec/tags/1.8.7/core/range/size_spec.rb +0 -1
- data/frozen_old_spec/tags/1.8.7/core/string/getbyte_spec.rb +0 -5
- data/frozen_old_spec/tags/1.8.7/core/string/prepend_spec.rb +0 -1
- data/frozen_old_spec/tags/1.8.7/core/string/setbyte_spec.rb +0 -5
- data/frozen_old_spec/tags/1.8.7/core/struct/new_spec.rb +0 -3
- data/frozen_old_spec/tags/1.8.7/core/symbol/capitalize_spec.rb +0 -3
- data/frozen_old_spec/tags/1.8.7/core/symbol/comparison_spec.rb +0 -1
- data/frozen_old_spec/tags/1.8.7/core/symbol/downcase_spec.rb +0 -2
- data/frozen_old_spec/tags/1.8.7/core/symbol/element_reference_spec.rb +0 -4
- data/frozen_old_spec/tags/1.8.7/core/symbol/empty_spec.rb +0 -1
- data/frozen_old_spec/tags/1.8.7/core/symbol/match_spec.rb +0 -2
- data/frozen_old_spec/tags/1.8.7/core/symbol/swapcase_spec.rb +0 -2
- data/frozen_old_spec/tags/1.8.7/core/symbol/upcase_spec.rb +0 -1
- data/frozen_old_spec/tags/1.9.1/core/array/append_spec.rb +0 -1
- data/frozen_old_spec/tags/1.9.1/core/array/rotate_spec.rb +0 -1
- data/frozen_old_spec/tags/1.9.1/core/enumerable/all_spec.rb +0 -1
- data/frozen_old_spec/tags/1.9.1/core/enumerable/any_spec.rb +0 -2
- data/frozen_old_spec/tags/1.9.1/core/enumerable/none_spec.rb +0 -1
- data/frozen_old_spec/tags/1.9.1/core/enumerable/one_spec.rb +0 -1
- data/frozen_old_spec/tags/1.9.1/core/env/to_h_spec.rb +0 -2
- data/frozen_old_spec/tags/1.9.1/core/hash/default_proc_spec.rb +0 -1
- data/frozen_old_spec/tags/1.9.1/core/io/write_spec.rb +0 -2
- data/frozen_old_spec/tags/1.9.1/core/module/alias_method_spec.rb +0 -4
- data/frozen_old_spec/tags/1.9.1/core/module/attr_accessor_spec.rb +0 -2
- data/frozen_old_spec/tags/1.9.1/core/module/attr_reader_spec.rb +0 -2
- data/frozen_old_spec/tags/1.9.1/core/module/attr_spec.rb +0 -1
- data/frozen_old_spec/tags/1.9.1/core/module/attr_writer_spec.rb +0 -2
- data/frozen_old_spec/tags/1.9.1/core/module/define_method_spec.rb +0 -3
- data/frozen_old_spec/tags/1.9.1/core/module/remove_method_spec.rb +0 -1
- data/frozen_old_spec/tags/1.9.1/core/module/undef_method_spec.rb +0 -1
- data/frozen_old_spec/tags/1.9.1/core/nil/dup_spec.rb +0 -1
- data/frozen_old_spec/tags/1.9.2/core/array/append_spec.rb +0 -1
- data/frozen_old_spec/tags/1.9.2/core/enumerable/all_spec.rb +0 -1
- data/frozen_old_spec/tags/1.9.2/core/enumerable/any_spec.rb +0 -2
- data/frozen_old_spec/tags/1.9.2/core/enumerable/none_spec.rb +0 -1
- data/frozen_old_spec/tags/1.9.2/core/enumerable/one_spec.rb +0 -1
- data/frozen_old_spec/tags/1.9.2/core/io/write_spec.rb +0 -3
- data/frozen_old_spec/tags/1.9.2/core/module/alias_method_spec.rb +0 -4
- data/frozen_old_spec/tags/1.9.2/core/module/attr_accessor_spec.rb +0 -2
- data/frozen_old_spec/tags/1.9.2/core/module/attr_reader_spec.rb +0 -2
- data/frozen_old_spec/tags/1.9.2/core/module/attr_spec.rb +0 -1
- data/frozen_old_spec/tags/1.9.2/core/module/attr_writer_spec.rb +0 -2
- data/frozen_old_spec/tags/1.9.2/core/module/define_method_spec.rb +0 -3
- data/frozen_old_spec/tags/1.9.2/core/module/remove_method_spec.rb +0 -1
- data/frozen_old_spec/tags/1.9.2/core/module/undef_method_spec.rb +0 -1
- data/frozen_old_spec/tags/1.9.2/core/nil/dup_spec.rb +0 -1
- data/frozen_old_spec/tags/1.9.3/core/enumerable/any_spec.rb +0 -1
- data/frozen_old_spec/tags/1.9.3/core/module/alias_method_spec.rb +0 -4
- data/frozen_old_spec/tags/1.9.3/core/module/attr_accessor_spec.rb +0 -1
- data/frozen_old_spec/tags/1.9.3/core/module/attr_reader_spec.rb +0 -1
- data/frozen_old_spec/tags/1.9.3/core/module/attr_spec.rb +0 -1
- data/frozen_old_spec/tags/1.9.3/core/module/attr_writer_spec.rb +0 -1
- data/frozen_old_spec/tags/1.9.3/core/module/define_method_spec.rb +0 -3
- data/frozen_old_spec/tags/1.9.3/core/module/remove_method_spec.rb +0 -1
- data/frozen_old_spec/tags/1.9.3/core/module/undef_method_spec.rb +0 -1
- data/frozen_old_spec/tags/2.0.0/core/enumerable/any_spec.rb +0 -1
- data/frozen_old_spec/tags/2.0.0/core/module/alias_method_spec.rb +0 -1
- data/frozen_old_spec/tags/2.0.0/core/module/attr_accessor_spec.rb +0 -2
- data/frozen_old_spec/tags/2.0.0/core/module/attr_reader_spec.rb +0 -2
- data/frozen_old_spec/tags/2.0.0/core/module/attr_spec.rb +0 -1
- data/frozen_old_spec/tags/2.0.0/core/module/attr_writer_spec.rb +0 -2
- data/frozen_old_spec/tags/2.0.0/core/module/define_method_spec.rb +0 -2
- data/frozen_old_spec/tags/2.0.0/core/module/remove_method_spec.rb +0 -1
- data/frozen_old_spec/tags/2.0.0/core/module/undef_method_spec.rb +0 -1
- data/frozen_old_spec/tags/2.0.0/core/nil/dup_spec.rb +0 -1
- data/frozen_old_spec/tags/2.0.0/core/struct/new_spec.rb +0 -1
- data/frozen_old_spec/tags/2.1.0/core/enumerable/any_spec.rb +0 -1
- data/frozen_old_spec/tags/2.1.0/core/module/alias_method_spec.rb +0 -1
- data/frozen_old_spec/tags/2.1.0/core/module/attr_accessor_spec.rb +0 -2
- data/frozen_old_spec/tags/2.1.0/core/module/attr_reader_spec.rb +0 -2
- data/frozen_old_spec/tags/2.1.0/core/module/attr_spec.rb +0 -1
- data/frozen_old_spec/tags/2.1.0/core/module/attr_writer_spec.rb +0 -2
- data/frozen_old_spec/tags/2.1.0/core/module/define_method_spec.rb +0 -2
- data/frozen_old_spec/tags/2.1.0/core/module/remove_method_spec.rb +0 -1
- data/frozen_old_spec/tags/2.1.0/core/module/undef_method_spec.rb +0 -1
- data/frozen_old_spec/tags/2.1.0/core/nil/dup_spec.rb +0 -1
- data/frozen_old_spec/tags/2.1.0/core/struct/new_spec.rb +0 -1
- data/frozen_old_spec/tags/2.2.0/core/enumerable/any_spec.rb +0 -1
- data/frozen_old_spec/tags/2.2.0/core/module/alias_method_spec.rb +0 -1
- data/frozen_old_spec/tags/2.2.0/core/module/attr_accessor_spec.rb +0 -2
- data/frozen_old_spec/tags/2.2.0/core/module/attr_reader_spec.rb +0 -2
- data/frozen_old_spec/tags/2.2.0/core/module/attr_spec.rb +0 -1
- data/frozen_old_spec/tags/2.2.0/core/module/attr_writer_spec.rb +0 -2
- data/frozen_old_spec/tags/2.2.0/core/module/define_method_spec.rb +0 -1
- data/frozen_old_spec/tags/2.2.0/core/module/remove_method_spec.rb +0 -1
- data/frozen_old_spec/tags/2.2.0/core/module/undef_method_spec.rb +0 -1
- data/frozen_old_spec/tags/2.2.0/core/nil/dup_spec.rb +0 -1
- data/frozen_old_spec/tags/2.2.0/core/struct/new_spec.rb +0 -1
- data/frozen_old_spec/tags/2.3.0/core/enumerable/any_spec.rb +0 -1
- data/frozen_old_spec/tags/2.3.0/core/module/alias_method_spec.rb +0 -1
- data/frozen_old_spec/tags/2.3.0/core/module/attr_accessor_spec.rb +0 -2
- data/frozen_old_spec/tags/2.3.0/core/module/attr_reader_spec.rb +0 -2
- data/frozen_old_spec/tags/2.3.0/core/module/attr_spec.rb +0 -1
- data/frozen_old_spec/tags/2.3.0/core/module/attr_writer_spec.rb +0 -2
- data/frozen_old_spec/tags/2.3.0/core/module/define_method_spec.rb +0 -1
- data/frozen_old_spec/tags/2.3.0/core/module/remove_method_spec.rb +0 -1
- data/frozen_old_spec/tags/2.3.0/core/module/undef_method_spec.rb +0 -1
- data/frozen_old_spec/tags/2.3.0/core/nil/dup_spec.rb +0 -1
- data/frozen_old_spec/tags/2.3.0/core/struct/new_spec.rb +0 -1
- data/frozen_old_spec/tags/2.3.5/core/struct/new_spec.rb +0 -1
- data/frozen_old_spec/tags/2.4.0/core/enumerable/any_spec.rb +0 -1
- data/frozen_old_spec/tags/2.4.0/core/module/alias_method_spec.rb +0 -1
- data/frozen_old_spec/tags/2.4.0/core/module/attr_accessor_spec.rb +0 -2
- data/frozen_old_spec/tags/2.4.0/core/module/attr_reader_spec.rb +0 -2
- data/frozen_old_spec/tags/2.4.0/core/module/attr_spec.rb +0 -1
- data/frozen_old_spec/tags/2.4.0/core/module/attr_writer_spec.rb +0 -2
- data/frozen_old_spec/tags/2.4.0/core/module/define_method_spec.rb +0 -1
- data/frozen_old_spec/tags/2.4.0/core/module/remove_method_spec.rb +0 -1
- data/frozen_old_spec/tags/2.4.0/core/module/undef_method_spec.rb +0 -1
- data/frozen_old_spec/tags/2.4.0/core/nil/dup_spec.rb +0 -1
- data/frozen_old_spec/tags/2.4.0/core/struct/new_spec.rb +0 -1
- data/frozen_old_spec/tags/2.5.0/core/enumerable/any_spec.rb +0 -1
- data/frozen_old_spec/tags/2.5.0/core/module/alias_method_spec.rb +0 -1
- data/frozen_old_spec/tags/2.5.0/core/module/attr_accessor_spec.rb +0 -2
- data/frozen_old_spec/tags/2.5.0/core/module/attr_reader_spec.rb +0 -2
- data/frozen_old_spec/tags/2.5.0/core/module/attr_spec.rb +0 -1
- data/frozen_old_spec/tags/2.5.0/core/module/attr_writer_spec.rb +0 -2
- data/frozen_old_spec/tags/2.5.0/core/module/define_method_spec.rb +0 -1
- data/frozen_old_spec/tags/2.5.0/core/module/remove_method_spec.rb +0 -1
- data/frozen_old_spec/tags/2.5.0/core/module/undef_method_spec.rb +0 -1
- data/frozen_old_spec/tags/2.5.0/core/nil/dup_spec.rb +0 -1
- data/frozen_old_spec/tags/2.5.0/core/struct/new_spec.rb +0 -1
- data/set_version/1.8.7.rb +0 -1
- data/set_version/1.9.1.rb +0 -1
- data/set_version/1.9.2.rb +0 -1
- data/set_version/1.9.3.rb +0 -1
- data/set_version/2.0.0.rb +0 -1
- data/set_version/2.1.0.rb +0 -1
- data/set_version/2.2.0.rb +0 -1
- data/set_version/2.3.0.rb +0 -1
- data/set_version/2.4.0.rb +0 -1
- data/set_version/2.5.0.rb +0 -1
- data/set_version/2.6.0.rb +0 -1
- data/set_version/setter.rb +0 -22
- data/spec/tags/1.8.7/core/array/to_h_spec.rb +0 -3
- data/spec/tags/1.8.7/core/enumerable/to_h_spec.rb +0 -2
- data/spec/tags/1.8.7/core/module/attr_spec.rb +0 -1
- data/spec/tags/1.8.7/core/module/include_spec.rb +0 -1
- data/spec/tags/1.9.1/core/array/bsearch_index_spec.rb +0 -1
- data/spec/tags/1.9.1/core/array/rotate_spec.rb +0 -1
- data/spec/tags/1.9.1/core/dir/each_child_spec.rb +0 -1
- data/spec/tags/1.9.1/core/env/to_h_spec.rb +0 -2
- data/spec/tags/1.9.1/core/hash/default_proc_spec.rb +0 -1
- data/spec/tags/1.9.1/core/hash/slice_spec.rb +0 -1
- data/spec/tags/1.9.1/core/hash/transform_keys_spec.rb +0 -2
- data/spec/tags/1.9.1/core/hash/transform_values_spec.rb +0 -2
- data/spec/tags/1.9.1/core/io/write_spec.rb +0 -3
- data/spec/tags/1.9.1/core/kernel/yield_self_spec.rb +0 -1
- data/spec/tags/1.9.1/core/method/curry_spec.rb +0 -1
- data/spec/tags/1.9.1/core/module/alias_method_spec.rb +0 -3
- data/spec/tags/1.9.1/core/module/attr_accessor_spec.rb +0 -1
- data/spec/tags/1.9.1/core/module/attr_reader_spec.rb +0 -1
- data/spec/tags/1.9.1/core/module/attr_spec.rb +0 -1
- data/spec/tags/1.9.1/core/module/attr_writer_spec.rb +0 -1
- data/spec/tags/1.9.1/core/module/define_method_spec.rb +0 -7
- data/spec/tags/1.9.1/core/string/uplus_spec.rb +0 -1
- data/spec/tags/1.9.1/core/struct/new_spec.rb +0 -2
- data/spec/tags/1.9.2/core/array/bsearch_index_spec.rb +0 -1
- data/spec/tags/1.9.2/core/array/to_h_spec.rb +0 -3
- data/spec/tags/1.9.2/core/dir/each_child_spec.rb +0 -1
- data/spec/tags/1.9.2/core/enumerable/to_h_spec.rb +0 -2
- data/spec/tags/1.9.2/core/hash/slice_spec.rb +0 -1
- data/spec/tags/1.9.2/core/hash/to_h_spec.rb +0 -3
- data/spec/tags/1.9.2/core/hash/transform_keys_spec.rb +0 -2
- data/spec/tags/1.9.2/core/hash/transform_values_spec.rb +0 -2
- data/spec/tags/1.9.2/core/io/write_spec.rb +0 -3
- data/spec/tags/1.9.2/core/kernel/then_spec.rb +0 -1
- data/spec/tags/1.9.2/core/kernel/yield_self_spec.rb +0 -1
- data/spec/tags/1.9.2/core/method/curry_spec.rb +0 -1
- data/spec/tags/1.9.2/core/module/alias_method_spec.rb +0 -3
- data/spec/tags/1.9.2/core/module/attr_accessor_spec.rb +0 -1
- data/spec/tags/1.9.2/core/module/attr_reader_spec.rb +0 -1
- data/spec/tags/1.9.2/core/module/attr_writer_spec.rb +0 -1
- data/spec/tags/1.9.2/core/module/define_method_spec.rb +0 -7
- data/spec/tags/1.9.2/core/module/include_spec.rb +0 -1
- data/spec/tags/1.9.2/core/string/uplus_spec.rb +0 -1
- data/spec/tags/1.9.2/core/struct/new_spec.rb +0 -2
- data/spec/tags/1.9.3/core/array/bsearch_index_spec.rb +0 -1
- data/spec/tags/1.9.3/core/dir/each_child_spec.rb +0 -1
- data/spec/tags/1.9.3/core/hash/slice_spec.rb +0 -1
- data/spec/tags/1.9.3/core/hash/to_h_spec.rb +0 -3
- data/spec/tags/1.9.3/core/hash/transform_keys_spec.rb +0 -2
- data/spec/tags/1.9.3/core/hash/transform_values_spec.rb +0 -2
- data/spec/tags/1.9.3/core/io/write_spec.rb +0 -3
- data/spec/tags/1.9.3/core/kernel/yield_self_spec.rb +0 -1
- data/spec/tags/1.9.3/core/method/curry_spec.rb +0 -1
- data/spec/tags/1.9.3/core/module/alias_method_spec.rb +0 -3
- data/spec/tags/1.9.3/core/module/attr_accessor_spec.rb +0 -1
- data/spec/tags/1.9.3/core/module/attr_reader_spec.rb +0 -1
- data/spec/tags/1.9.3/core/module/attr_writer_spec.rb +0 -1
- data/spec/tags/1.9.3/core/module/define_method_spec.rb +0 -7
- data/spec/tags/1.9.3/core/module/include_spec.rb +0 -1
- data/spec/tags/1.9.3/core/string/uplus_spec.rb +0 -1
- data/spec/tags/1.9.3/core/struct/new_spec.rb +0 -2
- data/spec/tags/2.0.0/core/array/to_h_spec.rb +0 -3
- data/spec/tags/2.0.0/core/enumerable/to_h_spec.rb +0 -2
- data/spec/tags/2.0.0/core/hash/slice_spec.rb +0 -1
- data/spec/tags/2.0.0/core/hash/to_h_spec.rb +0 -3
- data/spec/tags/2.0.0/core/module/attr_accessor_spec.rb +0 -1
- data/spec/tags/2.0.0/core/module/attr_reader_spec.rb +0 -1
- data/spec/tags/2.0.0/core/module/attr_spec.rb +0 -1
- data/spec/tags/2.0.0/core/module/attr_writer_spec.rb +0 -1
- data/spec/tags/2.0.0/core/module/define_method_spec.rb +0 -4
- data/spec/tags/2.0.0/core/module/include_spec.rb +0 -1
- data/spec/tags/2.0.0/core/string/uplus_spec.rb +0 -1
- data/spec/tags/2.0.0/core/struct/new_spec.rb +0 -1
- data/spec/tags/2.1.0/core/array/union_spec.rb +0 -1
- data/spec/tags/2.1.0/core/hash/slice_spec.rb +0 -1
- data/spec/tags/2.1.0/core/hash/to_h_spec.rb +0 -1
- data/spec/tags/2.1.0/core/module/attr_accessor_spec.rb +0 -1
- data/spec/tags/2.1.0/core/module/attr_reader_spec.rb +0 -1
- data/spec/tags/2.1.0/core/module/attr_spec.rb +0 -1
- data/spec/tags/2.1.0/core/module/attr_writer_spec.rb +0 -1
- data/spec/tags/2.1.0/core/module/define_method_spec.rb +0 -4
- data/spec/tags/2.1.0/core/string/uplus_spec.rb +0 -1
- data/spec/tags/2.1.0/core/struct/new_spec.rb +0 -1
- data/spec/tags/2.2.0/core/hash/slice_spec.rb +0 -1
- data/spec/tags/2.2.0/core/hash/to_h_spec.rb +0 -1
- data/spec/tags/2.2.0/core/module/attr_accessor_spec.rb +0 -1
- data/spec/tags/2.2.0/core/module/attr_reader_spec.rb +0 -1
- data/spec/tags/2.2.0/core/module/attr_spec.rb +0 -1
- data/spec/tags/2.2.0/core/module/attr_writer_spec.rb +0 -1
- data/spec/tags/2.2.0/core/module/define_method_spec.rb +0 -4
- data/spec/tags/2.2.0/core/string/uplus_spec.rb +0 -1
- data/spec/tags/2.2.0/core/struct/new_spec.rb +0 -1
- data/spec/tags/2.3.0/core/hash/slice_spec.rb +0 -1
- data/spec/tags/2.3.0/core/hash/to_h_spec.rb +0 -1
- data/spec/tags/2.3.0/core/module/attr_spec.rb +0 -1
- data/spec/tags/2.3.0/core/string/uplus_spec.rb +0 -1
- data/spec/tags/2.3.0/core/struct/new_spec.rb +0 -1
- data/spec/tags/2.4.0/core/hash/slice_spec.rb +0 -1
- data/spec/tags/2.4.0/core/hash/to_h_spec.rb +0 -1
- data/spec/tags/2.4.0/core/module/attr_spec.rb +0 -1
- data/spec/tags/2.4.0/core/struct/new_spec.rb +0 -1
- data/spec/tags/2.5.0/core/hash/to_h_spec.rb +0 -1
- data/test/README +0 -2
- data/test/_backport_guards_test.rb +0 -148
- data/test/bit_length_test.rb +0 -11
- data/test/lazy_test.rb +0 -487
- data/test/socket_interaction_test.rb +0 -9
- data/test/test_helper.rb +0 -1
data/Gemfile
CHANGED
@@ -1,23 +1,16 @@
|
|
1
1
|
source "http://rubygems.org"
|
2
2
|
|
3
|
-
# Declare your gem's dependencies in backports.gemspec.
|
4
|
-
# Bundler will treat runtime dependencies like base dependencies, and
|
5
|
-
# development dependencies will be added by default to the :development group.
|
6
3
|
gemspec
|
7
4
|
|
8
|
-
# jquery-rails is used by the dummy application
|
9
5
|
group :test do
|
10
6
|
gem "rake"
|
11
7
|
gem 'mspec'
|
12
8
|
gem 'activesupport', '~>3.2.0'
|
13
|
-
gem '
|
14
|
-
gem 'test-unit', '~>2.1.1.0'
|
9
|
+
gem 'test-unit'
|
15
10
|
end
|
16
11
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
# To use debugger
|
23
|
-
# gem 'ruby-debug19', :require => 'ruby-debug'
|
12
|
+
if RUBY_VERSION >= '2.4.0'
|
13
|
+
group :development do
|
14
|
+
gem 'rubocop', '<1.13.0'
|
15
|
+
end
|
16
|
+
end
|
data/README.md
ADDED
@@ -0,0 +1,706 @@
|
|
1
|
+
# Backports Library [<img src="https://travis-ci.org/marcandre/backports.svg?branch=master">](https://travis-ci.org/marcandre/backports) [<img src="https://badge.fury.io/rb/backports.svg" alt="Gem Version" />](http://badge.fury.io/rb/backports) [![Tidelift](https://tidelift.com/badges/package/rubygems/backports)](https://tidelift.com/subscription/pkg/rubygems-backports?utm_source=rubygems-backports&utm_medium=referral&utm_campaign=readme)
|
2
|
+
|
3
|
+
Yearning to write a gem using some new cool features in Ruby 3.2 while
|
4
|
+
still supporting Ruby 2.5.x?
|
5
|
+
Have some legacy code in Ruby 1.8 but can't live without `flat_map`?
|
6
|
+
|
7
|
+
This gem is for you!
|
8
|
+
|
9
|
+
The goal of 'backports' is to make it easier to write ruby code that runs
|
10
|
+
across different versions of Ruby.
|
11
|
+
|
12
|
+
Note: [Next major version (X-mas
|
13
|
+
2021?)](https://github.com/marcandre/backports/issues/139) may drop support
|
14
|
+
for Ruby < 2.2.
|
15
|
+
|
16
|
+
## Loading backports
|
17
|
+
|
18
|
+
### Explicitly (recommended)
|
19
|
+
|
20
|
+
For example, if you want to use `transform_values` and `transform_keys`, even in
|
21
|
+
Ruby implementations that don't include it:
|
22
|
+
|
23
|
+
require 'backports/2.4.0/hash/transform_values'
|
24
|
+
require 'backports/2.5.0/hash/transform_keys'
|
25
|
+
|
26
|
+
This will enable `Hash#transform_values` and `Hash#transform_keys`, using the
|
27
|
+
native versions if available or otherwise provide a pure Ruby version.
|
28
|
+
|
29
|
+
### By Module
|
30
|
+
|
31
|
+
To bring all the backports for a given Class/Module, you can specify only that
|
32
|
+
Class:
|
33
|
+
|
34
|
+
require 'backports/2.3.0/hash'
|
35
|
+
|
36
|
+
This will make sure that Hash responds to `dig`, `fetch_values`, `to_proc` and comparisons.
|
37
|
+
|
38
|
+
### Up to a specific Ruby version (for quick coding)
|
39
|
+
|
40
|
+
You can load all backports up to a specific version.
|
41
|
+
For example, to bring any version of Ruby mostly up to Ruby 3.2.0's standards:
|
42
|
+
|
43
|
+
require 'backports/3.2.0'
|
44
|
+
|
45
|
+
This will bring in all the features of 1.8.7 and many features of Ruby 1.9.x
|
46
|
+
all the way up to Ruby 3.2.0 (for all versions of Ruby)!
|
47
|
+
|
48
|
+
You may `require 'backports/latest'` as a
|
49
|
+
shortcut to the latest Ruby version supported.
|
50
|
+
|
51
|
+
_Note_: For production / public gems, it is highly recommended you only require
|
52
|
+
the backports you need explicitly.
|
53
|
+
|
54
|
+
_Note_: Although I am a Ruby committer, this gem is a personal project and is
|
55
|
+
not endorsed by ruby-core.
|
56
|
+
|
57
|
+
## What's inside
|
58
|
+
|
59
|
+
Goals for backported features:
|
60
|
+
|
61
|
+
1. Won't break older code
|
62
|
+
2. Pure Ruby (no C extensions)
|
63
|
+
3. Pass [ruby/spec](https://github.com/ruby/spec)
|
64
|
+
|
65
|
+
Let's be a bit more precise about the "breaking code" business. It is of
|
66
|
+
course entirely possible that code will break. In particular, you may be
|
67
|
+
distinguishing parameters with duck typing, but a builtin class may, in the
|
68
|
+
future, be responding to a particular call. Here's [an example from Rails][]
|
69
|
+
that is relying on the fact that Proc and Method respond to :to_proc and Hash
|
70
|
+
isn't. That is, until Ruby 2.3... This old version of Rails therefore won't
|
71
|
+
work on Ruby 2.3, or on older Rubies with that the `2.3.0/hash/to_proc`
|
72
|
+
loaded...
|
73
|
+
|
74
|
+
[an example from rails]: https://github.com/rails/rails/blob/a4b55827721a5967299f3c1531afb3d6d81e4ac0/activerecord/lib/active_record/associations/association.rb#L155-L159
|
75
|
+
|
76
|
+
For Ruby < 2.0, there are some real incompatibilities. For example,
|
77
|
+
`Module::instance_methods` which returns strings in 1.8 and symbols in 1.9. No
|
78
|
+
change can be made without the risk of breaking existing code. Such
|
79
|
+
incompatibilities are left unchanged, although you can require some of these
|
80
|
+
changes in addition (see below).
|
81
|
+
|
82
|
+
## Installation & compatibility
|
83
|
+
|
84
|
+
`backports` can be installed with:
|
85
|
+
|
86
|
+
gem install backports
|
87
|
+
|
88
|
+
To use:
|
89
|
+
|
90
|
+
require 'rubygems'
|
91
|
+
# For only specific backports:
|
92
|
+
require 'backports/1.9.1/kernel/require_relative'
|
93
|
+
require 'backports/2.0.0/enumerable/lazy'
|
94
|
+
|
95
|
+
# For all backports up to a given version
|
96
|
+
require 'backports/1.9.2' # All backports for Ruby 1.9.2 and below
|
97
|
+
|
98
|
+
Note: about a dozen of backports have a dependency that will be also loaded.
|
99
|
+
For example, the backport of Enumerable#flat_map uses flatten(1), so if
|
100
|
+
required from Ruby 1.8.6 (where Array#flatten does not accept an argument),
|
101
|
+
the backport for Ruby's 1.8.7 flatten with an argument will also be loaded.
|
102
|
+
|
103
|
+
With bundler, add to your Gemfile:
|
104
|
+
|
105
|
+
gem 'backports', :require => false
|
106
|
+
|
107
|
+
Run `bundle install` and require the desired backports. Compatible with Ruby
|
108
|
+
itself, JRuby and Rubinius.
|
109
|
+
|
110
|
+
# Complete List of backports
|
111
|
+
|
112
|
+
## Ruby 3.2 backports
|
113
|
+
|
114
|
+
#### Class
|
115
|
+
|
116
|
+
- `attached_object`
|
117
|
+
|
118
|
+
#### Data
|
119
|
+
|
120
|
+
- Complete class
|
121
|
+
|
122
|
+
#### Enumerator
|
123
|
+
|
124
|
+
- `Enumerator.product` and `Enumerator::Product`
|
125
|
+
|
126
|
+
#### Hash
|
127
|
+
|
128
|
+
- `shift` (with correct behavior when empty)
|
129
|
+
|
130
|
+
#### Integer
|
131
|
+
|
132
|
+
- `ceildiv`
|
133
|
+
|
134
|
+
#### MatchData
|
135
|
+
|
136
|
+
- `byteoffset`
|
137
|
+
|
138
|
+
## Ruby 3.1 backports
|
139
|
+
|
140
|
+
#### Array
|
141
|
+
|
142
|
+
- `intersect?`
|
143
|
+
|
144
|
+
#### Class
|
145
|
+
|
146
|
+
- `subclasses`
|
147
|
+
|
148
|
+
#### Enumerable
|
149
|
+
|
150
|
+
- `compact`
|
151
|
+
- `tally` (with hash argument)
|
152
|
+
|
153
|
+
### File
|
154
|
+
|
155
|
+
- `dirname` (with depth argument)
|
156
|
+
|
157
|
+
#### Integer
|
158
|
+
|
159
|
+
- `try_convert`
|
160
|
+
|
161
|
+
#### MatchData
|
162
|
+
|
163
|
+
- `match`
|
164
|
+
- `match_length`
|
165
|
+
|
166
|
+
#### Struct
|
167
|
+
|
168
|
+
- `keyword_init?`
|
169
|
+
|
170
|
+
## Ruby 3.0 backports
|
171
|
+
|
172
|
+
#### Env
|
173
|
+
|
174
|
+
- `except`
|
175
|
+
|
176
|
+
#### Hash
|
177
|
+
|
178
|
+
- `except`
|
179
|
+
- `transform_keys`, `transform_keys!` (with hash argument)
|
180
|
+
|
181
|
+
#### Ractor
|
182
|
+
|
183
|
+
- All methods, with the caveats:
|
184
|
+
- uses Ruby's `Thread` internally
|
185
|
+
- will not raise some errors when `Ractor` would (in particular `Ractor::IsolationError`)
|
186
|
+
- supported in Ruby 2.0+ only
|
187
|
+
|
188
|
+
#### Symbol
|
189
|
+
|
190
|
+
- `name`
|
191
|
+
|
192
|
+
## Ruby 2.7 backports
|
193
|
+
|
194
|
+
#### Array
|
195
|
+
|
196
|
+
- `intersection`
|
197
|
+
|
198
|
+
#### Comparable
|
199
|
+
|
200
|
+
- `clamp` (with range)
|
201
|
+
|
202
|
+
#### Complex
|
203
|
+
|
204
|
+
- `<=>`
|
205
|
+
|
206
|
+
#### Enumerable
|
207
|
+
|
208
|
+
- `filter_map`
|
209
|
+
- `tally`
|
210
|
+
|
211
|
+
#### Enumerator
|
212
|
+
|
213
|
+
- `produce` (class method)
|
214
|
+
|
215
|
+
#### Symbol
|
216
|
+
|
217
|
+
- `end_with?`
|
218
|
+
- `start_with?`
|
219
|
+
|
220
|
+
#### Time
|
221
|
+
|
222
|
+
- `floor`, `ceil`
|
223
|
+
|
224
|
+
## Ruby 2.6 backports
|
225
|
+
|
226
|
+
#### Array
|
227
|
+
|
228
|
+
- `difference`, `union`
|
229
|
+
- `to_h` (with block)
|
230
|
+
|
231
|
+
#### Enumerable
|
232
|
+
|
233
|
+
- `chain`
|
234
|
+
- `to_h` (with block)
|
235
|
+
|
236
|
+
#### Enumerator::Chain (use Enumerable#chain)
|
237
|
+
|
238
|
+
#### Hash
|
239
|
+
|
240
|
+
- `merge`, `merge!`/`update` (with multiple arguments)
|
241
|
+
- `to_h` (with block)
|
242
|
+
|
243
|
+
#### Kernel
|
244
|
+
|
245
|
+
- `then`
|
246
|
+
|
247
|
+
#### Method
|
248
|
+
|
249
|
+
- `<<`, `>>`
|
250
|
+
|
251
|
+
#### Proc
|
252
|
+
|
253
|
+
- `<<`, `>>`
|
254
|
+
|
255
|
+
#### Range
|
256
|
+
|
257
|
+
- `cover?` (with `Range` argument)
|
258
|
+
|
259
|
+
## Ruby 2.5 backports
|
260
|
+
|
261
|
+
#### Array
|
262
|
+
|
263
|
+
- `append`, `prepend`
|
264
|
+
|
265
|
+
#### Dir
|
266
|
+
|
267
|
+
- `children`, `each_child`
|
268
|
+
|
269
|
+
#### Enumerable
|
270
|
+
|
271
|
+
- `any?`, `all?`, `none?`, `one?` (with pattern argument)
|
272
|
+
|
273
|
+
#### Hash
|
274
|
+
|
275
|
+
- `slice`
|
276
|
+
- `transform_keys`
|
277
|
+
|
278
|
+
#### Integer
|
279
|
+
|
280
|
+
- `sqrt`
|
281
|
+
- `allbits?`, `anybits?` and `nobits?`
|
282
|
+
|
283
|
+
#### Kernel
|
284
|
+
|
285
|
+
- `yield_self`
|
286
|
+
|
287
|
+
#### Module
|
288
|
+
|
289
|
+
- `attr`, `attr_accessor`, `attr_reader`, `attr_writer` (now public)
|
290
|
+
- `define_method`, `alias_method`, `undef_method`, `remove_method` (now
|
291
|
+
public)
|
292
|
+
|
293
|
+
#### String
|
294
|
+
|
295
|
+
- `delete_prefix`, `delete_prefix!`
|
296
|
+
- `delete_suffix`, `delete_suffix!`
|
297
|
+
- `undump`
|
298
|
+
|
299
|
+
#### Struct
|
300
|
+
|
301
|
+
- `new` (with `keyword_init: true`)
|
302
|
+
|
303
|
+
## Ruby 2.4 backports
|
304
|
+
|
305
|
+
#### Comparable
|
306
|
+
|
307
|
+
- `clamp`
|
308
|
+
|
309
|
+
#### Enumerable
|
310
|
+
|
311
|
+
- `sum`
|
312
|
+
- `uniq`
|
313
|
+
|
314
|
+
#### Hash
|
315
|
+
|
316
|
+
- `compact`, `compact!`
|
317
|
+
- `transform_values`, `transform_values!`
|
318
|
+
|
319
|
+
#### Queue
|
320
|
+
|
321
|
+
- `close`, `closed?`
|
322
|
+
|
323
|
+
#### Regexp
|
324
|
+
|
325
|
+
- `match?`
|
326
|
+
|
327
|
+
#### String
|
328
|
+
|
329
|
+
- `match?`
|
330
|
+
- `unpack1`
|
331
|
+
|
332
|
+
#### FalseClass, Fixnum, Bignum, Float, NilClass, TrueClass
|
333
|
+
|
334
|
+
- `dup`
|
335
|
+
|
336
|
+
## Ruby 2.3 backports
|
337
|
+
|
338
|
+
#### Array
|
339
|
+
|
340
|
+
- `bsearch_index`
|
341
|
+
- `dig`
|
342
|
+
|
343
|
+
#### Enumerable
|
344
|
+
|
345
|
+
- `chunk_while`
|
346
|
+
- `grep_v`
|
347
|
+
|
348
|
+
#### Hash
|
349
|
+
|
350
|
+
- `dig`
|
351
|
+
- `fetch_values`
|
352
|
+
- `to_proc`
|
353
|
+
- <=, <, >=, >
|
354
|
+
|
355
|
+
#### Numeric
|
356
|
+
|
357
|
+
- `negative?`
|
358
|
+
- `positive?`
|
359
|
+
|
360
|
+
#### String
|
361
|
+
|
362
|
+
- unary + and -
|
363
|
+
|
364
|
+
#### Struct
|
365
|
+
|
366
|
+
- `dig`
|
367
|
+
|
368
|
+
## Ruby 2.2 backports
|
369
|
+
|
370
|
+
#### Enumerable
|
371
|
+
|
372
|
+
- `slice_after`
|
373
|
+
- `slice_when`
|
374
|
+
|
375
|
+
#### Float
|
376
|
+
|
377
|
+
- `prev_float`
|
378
|
+
- `next_float`
|
379
|
+
|
380
|
+
#### Kernel
|
381
|
+
|
382
|
+
- `itself`
|
383
|
+
|
384
|
+
#### Method
|
385
|
+
|
386
|
+
- `curry`
|
387
|
+
- `super_method`
|
388
|
+
|
389
|
+
#### String
|
390
|
+
|
391
|
+
- `unicode_normalize`
|
392
|
+
- `unicode_normalize!`
|
393
|
+
- `unicode_normalize?`
|
394
|
+
|
395
|
+
## Ruby 2.1 backports
|
396
|
+
|
397
|
+
#### Array
|
398
|
+
|
399
|
+
- `to_h`
|
400
|
+
|
401
|
+
#### Bignum
|
402
|
+
|
403
|
+
- `bit_length`
|
404
|
+
|
405
|
+
#### Enumerable
|
406
|
+
|
407
|
+
- `to_h`
|
408
|
+
|
409
|
+
#### Fixnum
|
410
|
+
|
411
|
+
- `bit_length`
|
412
|
+
|
413
|
+
#### Module
|
414
|
+
|
415
|
+
- `include` (now public)
|
416
|
+
- `singleton_class?`
|
417
|
+
|
418
|
+
## Ruby 2.0 backports
|
419
|
+
|
420
|
+
#### Array
|
421
|
+
|
422
|
+
- `bsearch`
|
423
|
+
|
424
|
+
#### Enumerable
|
425
|
+
|
426
|
+
- `lazy`
|
427
|
+
|
428
|
+
#### Enumerator::Lazy
|
429
|
+
|
430
|
+
- all methods
|
431
|
+
|
432
|
+
#### Hash
|
433
|
+
|
434
|
+
- `default_proc=` (with nil argument)
|
435
|
+
- `to_h`
|
436
|
+
|
437
|
+
#### `nil.to_h`
|
438
|
+
|
439
|
+
#### Range
|
440
|
+
|
441
|
+
- `bsearch`
|
442
|
+
|
443
|
+
#### Struct
|
444
|
+
|
445
|
+
- `to_h`
|
446
|
+
|
447
|
+
## Ruby 1.9.3 backports
|
448
|
+
|
449
|
+
#### File
|
450
|
+
|
451
|
+
- `NULL`
|
452
|
+
|
453
|
+
#### IO
|
454
|
+
|
455
|
+
- `advise` (acts as a noop)
|
456
|
+
- `write`, `binwrite`
|
457
|
+
|
458
|
+
#### String
|
459
|
+
|
460
|
+
- `byteslice`
|
461
|
+
- `prepend`
|
462
|
+
|
463
|
+
## Ruby 1.9.2 backports
|
464
|
+
|
465
|
+
#### Array
|
466
|
+
|
467
|
+
- `rotate, rotate!`
|
468
|
+
- `keep_if, select!`
|
469
|
+
- `product` (with block)
|
470
|
+
- `repeated_combination`, `repeated_permutation`
|
471
|
+
- `sort_by!`
|
472
|
+
- `uniq, uniq!` (with block)
|
473
|
+
|
474
|
+
#### Complex
|
475
|
+
|
476
|
+
- `to_r`
|
477
|
+
|
478
|
+
#### Dir
|
479
|
+
|
480
|
+
- `home`
|
481
|
+
|
482
|
+
#### Enumerable
|
483
|
+
|
484
|
+
- `chunk`
|
485
|
+
- `flat_map`, `collect_concat`
|
486
|
+
- `join`
|
487
|
+
- `slice_before`
|
488
|
+
|
489
|
+
#### Float::INFINITY, NAN
|
490
|
+
|
491
|
+
#### Hash
|
492
|
+
|
493
|
+
- `keep_if`, `select!`
|
494
|
+
|
495
|
+
#### Object
|
496
|
+
|
497
|
+
- `singleton_class`
|
498
|
+
|
499
|
+
#### Random (new class)
|
500
|
+
|
501
|
+
_Note_: The methods of `Random` can't be required individually; the class
|
502
|
+
can only be required whole with `require 'backports/1.9.2/random'`.
|
503
|
+
|
504
|
+
## Ruby 1.9.1 backports
|
505
|
+
|
506
|
+
Additionally, the following Ruby 1.9 features have been backported:
|
507
|
+
|
508
|
+
#### Array
|
509
|
+
|
510
|
+
- `try_convert`
|
511
|
+
- `sample`
|
512
|
+
|
513
|
+
#### Enumerable
|
514
|
+
|
515
|
+
- `each_with_object`
|
516
|
+
- `each_with_index` (with arguments)
|
517
|
+
|
518
|
+
#### Enumerator
|
519
|
+
|
520
|
+
- `new` (with block)
|
521
|
+
|
522
|
+
#### File
|
523
|
+
|
524
|
+
- `binread`
|
525
|
+
- `to_path`
|
526
|
+
- All class methods accepting filenames will accept files or anything
|
527
|
+
with a `#to_path` method.
|
528
|
+
- `File.open` accepts an options hash.
|
529
|
+
|
530
|
+
#### Float
|
531
|
+
|
532
|
+
- `round`
|
533
|
+
|
534
|
+
#### Hash
|
535
|
+
|
536
|
+
- `assoc`, `rassoc`
|
537
|
+
- `key`
|
538
|
+
- `try_convert`
|
539
|
+
- `default_proc=`
|
540
|
+
|
541
|
+
#### Integer
|
542
|
+
|
543
|
+
- `magnitude`
|
544
|
+
- `round`
|
545
|
+
|
546
|
+
#### IO
|
547
|
+
|
548
|
+
- `bin_read`
|
549
|
+
- `try_convert`
|
550
|
+
- `ungetbyte`
|
551
|
+
- `IO.open` accepts an options hash.
|
552
|
+
|
553
|
+
#### Kernel
|
554
|
+
|
555
|
+
- `require_relative`
|
556
|
+
|
557
|
+
#### Math
|
558
|
+
|
559
|
+
- `log` (with base)
|
560
|
+
- `log2`
|
561
|
+
|
562
|
+
#### Numeric
|
563
|
+
|
564
|
+
- `round`
|
565
|
+
|
566
|
+
#### Object
|
567
|
+
|
568
|
+
- `define_singleton_method`
|
569
|
+
- `public_method`
|
570
|
+
- `public_send`
|
571
|
+
|
572
|
+
#### Proc
|
573
|
+
|
574
|
+
- `yield`
|
575
|
+
- `lambda?`
|
576
|
+
- `curry`
|
577
|
+
- `===`
|
578
|
+
|
579
|
+
#### Range
|
580
|
+
|
581
|
+
- `cover?`
|
582
|
+
|
583
|
+
#### Regexp
|
584
|
+
|
585
|
+
- `try_convert`
|
586
|
+
|
587
|
+
#### String
|
588
|
+
|
589
|
+
- `ascii_only?`
|
590
|
+
- `chr`
|
591
|
+
- `clear`
|
592
|
+
- `codepoints`, `each_codepoint`
|
593
|
+
- `get_byte`, `set_byte`
|
594
|
+
- `ord`
|
595
|
+
- `try_convert`
|
596
|
+
|
597
|
+
`Enumerator` can be accessed directly (instead of `Enumerable::Enumerator`)
|
598
|
+
|
599
|
+
To include _only_ these backports and those of the 1.8 line, `require "backports/1.9.1"`.
|
600
|
+
|
601
|
+
Moreover, a pretty good imitation of `BasicObject` is available, but since it
|
602
|
+
is only an imitation, it must be required explicitly:
|
603
|
+
|
604
|
+
require 'backports/basic_object'
|
605
|
+
|
606
|
+
## Ruby 1.8.7
|
607
|
+
|
608
|
+
Complete Ruby 1.8.7 backporting (core language). Refer to the official list of
|
609
|
+
[changes](https://github.com/ruby/ruby/blob/ruby_1_8_7/NEWS). That's about 130
|
610
|
+
backports!
|
611
|
+
|
612
|
+
Only exceptions:
|
613
|
+
|
614
|
+
#### String#gsub (the form returning an enumerator)
|
615
|
+
|
616
|
+
#### GC.stress= (not implemented)
|
617
|
+
|
618
|
+
#### Array#choice (removed in 1.9, use 1.9.1's Array#sample instead)
|
619
|
+
|
620
|
+
## Libraries
|
621
|
+
|
622
|
+
Libraries were slowly being backported, but they are now available as separate gems.
|
623
|
+
|
624
|
+
The backports would be automatically used after requiring 'backports/std_lib' but this is now deprecated and discouraged.
|
625
|
+
|
626
|
+
The following libraries are up to date with Ruby 1.9.3:
|
627
|
+
|
628
|
+
#### Matrix
|
629
|
+
|
630
|
+
#### Prime
|
631
|
+
|
632
|
+
#### Set
|
633
|
+
|
634
|
+
The following library is to date with Ruby 2.0.0:
|
635
|
+
|
636
|
+
#### OpenStruct (ostruct)
|
637
|
+
|
638
|
+
I am aware of the following backport gem, which probably won't make it into
|
639
|
+
this gem:
|
640
|
+
|
641
|
+
#### Net::SMTP for Ruby 1.8.6:
|
642
|
+
|
643
|
+
[smtp_tls](http://seattlerb.rubyforge.org/smtp_tls/)
|
644
|
+
|
645
|
+
Requiring backports for a given version of Ruby will also load
|
646
|
+
'backports/std_lib'.
|
647
|
+
|
648
|
+
## Forcing incompatibilities
|
649
|
+
|
650
|
+
Some backports would create incompatibilities in their current Ruby version
|
651
|
+
but could be useful in some projects. It is possible to request such
|
652
|
+
incompatible changes. Backports currently supports the following:
|
653
|
+
|
654
|
+
#### Hash
|
655
|
+
|
656
|
+
- `select` (returns a Hash instead of an Array)
|
657
|
+
|
658
|
+
#### Enumerable / Array
|
659
|
+
|
660
|
+
- `map` (returns an enumerator when called without a block)
|
661
|
+
|
662
|
+
#### String
|
663
|
+
|
664
|
+
- `length`, `size` (for UTF-8 support)
|
665
|
+
|
666
|
+
These must be imported in addition to the backports gem, for example:
|
667
|
+
|
668
|
+
require "backports/force/hash_select"
|
669
|
+
{}.select{} # => {}, even in Ruby 1.8
|
670
|
+
|
671
|
+
## Thanks
|
672
|
+
|
673
|
+
Thanks for the bug reports and patches, in particular the repeat offenders:
|
674
|
+
|
675
|
+
#### Arto Bendiken ( [bendiken](http://github.com/bendiken) )
|
676
|
+
|
677
|
+
#### Konstantin Haase ( [rkh](https://github.com/rkh) )
|
678
|
+
|
679
|
+
#### Roger Pack ( [rdp](http://github.com/rdp) )
|
680
|
+
|
681
|
+
#### Victor Shepelev ( [zverok](http://github.com/zverok) )
|
682
|
+
|
683
|
+
## Contributing
|
684
|
+
|
685
|
+
The best way to submit a patch is to also submit a patch to
|
686
|
+
[ruby/spec](https://github.com/ruby/spec) and then a patch to backports that
|
687
|
+
make it pass the spec.
|
688
|
+
|
689
|
+
See below to test rubyspec. Note that only features missing from your Ruby
|
690
|
+
version are tested.
|
691
|
+
|
692
|
+
git submodule init && git submodule update # => pulls rubyspecs
|
693
|
+
bundle install
|
694
|
+
bundle exec rake spec[hash/slice] # => tests Hash#slice (must be in Ruby 2.4 or less)
|
695
|
+
bundle exec rake spec[hash/*] # => tests all backported Hash methods
|
696
|
+
bundle exec rake spec (or rake spec[*/*]) # => all rubyspecs for backported methods
|
697
|
+
|
698
|
+
Failures that are acceptable are added the to `tags` file.
|
699
|
+
|
700
|
+
# License
|
701
|
+
|
702
|
+
`backports` is released under the terms of the MIT License, see the included
|
703
|
+
LICENSE file.
|
704
|
+
|
705
|
+
Author
|
706
|
+
: Marc-André Lafortune
|