backports 3.16.0 → 3.18.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +691 -0
- data/Gemfile +6 -0
- data/README.md +529 -0
- data/SECURITY.md +5 -0
- data/backports.gemspec +5 -1
- data/lib/backports.rb +6 -0
- data/lib/backports/1.8.7.rb +10 -2
- data/lib/backports/1.9.1.rb +6 -1
- data/lib/backports/1.9.2.rb +6 -1
- data/lib/backports/1.9.2/stdlib/matrix.rb +5 -0
- data/lib/backports/1.9.3.rb +6 -1
- data/lib/backports/2.0.0.rb +6 -1
- data/lib/backports/2.0.0/range/size.rb +2 -0
- data/lib/backports/2.1.0.rb +1 -1
- data/lib/backports/2.2.0.rb +1 -1
- 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.3.0.rb +1 -1
- 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/struct/dig.rb +1 -2
- data/lib/backports/2.4.0.rb +1 -1
- data/lib/backports/2.4.0/hash/transform_values.rb +2 -2
- data/lib/backports/2.4.0/true_class/dup.rb +0 -1
- data/lib/backports/2.5.0.rb +1 -1
- data/lib/backports/2.5.0/hash/transform_keys.rb +1 -1
- 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 +3 -7
- data/lib/backports/2.5.0/struct/new.rb +1 -1
- data/lib/backports/2.6.0.rb +1 -1
- data/lib/backports/2.6.0/enumerable/chain.rb +4 -1
- data/lib/backports/2.6.0/hash/to_h.rb +1 -1
- data/lib/backports/2.6.0/range.rb +3 -0
- data/lib/backports/2.6.0/range/cover.rb +22 -0
- data/lib/backports/2.7.0.rb +1 -1
- data/lib/backports/2.7.0/enumerable/filter_map.rb +2 -2
- 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
- metadata +10 -511
- data/.document +0 -6
- data/.gitignore +0 -9
- data/.gitmodules +0 -6
- data/.irbrc +0 -3
- data/.travis.yml +0 -19
- data/CHANGELOG.rdoc +0 -504
- data/README.rdoc +0 -445
- data/Rakefile +0 -192
- 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/2.7.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/array/to_h_spec.rb +0 -3
- data/spec/tags/1.9.3/core/dir/each_child_spec.rb +0 -1
- data/spec/tags/1.9.3/core/enumerable/grep_v_spec.rb +0 -2
- data/spec/tags/1.9.3/core/enumerable/to_h_spec.rb +0 -2
- data/spec/tags/1.9.3/core/enumerator/produce_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/then_spec.rb +0 -1
- 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/grep_v_spec.rb +0 -2
- 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 -5
- data/spec/tags/2.0.0/core/module/include_spec.rb +0 -1
- data/spec/tags/2.0.0/core/module/undef_method_spec.rb +0 -2
- 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 -3
- data/spec/tags/2.1.0/core/array/union_spec.rb +0 -1
- data/spec/tags/2.1.0/core/enumerable/grep_v_spec.rb +0 -2
- 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 -5
- data/spec/tags/2.1.0/core/module/undef_method_spec.rb +0 -2
- 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 -3
- data/spec/tags/2.2.0/core/enumerable/grep_v_spec.rb +0 -2
- 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 -5
- data/spec/tags/2.2.0/core/module/undef_method_spec.rb +0 -2
- 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 -3
- 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 -3
- 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 -152
- 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
@@ -14,6 +14,12 @@ group :test do
|
|
14
14
|
gem 'test-unit', '~>2.1.1.0'
|
15
15
|
end
|
16
16
|
|
17
|
+
if RUBY_VERSION >= '2.3.0'
|
18
|
+
group :development do
|
19
|
+
gem 'rubocop', '~> 0.80.0'
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
17
23
|
# Declare any dependencies that are still in development here instead of in
|
18
24
|
# your gemspec. These might include edge Rails or gems from your path or
|
19
25
|
# Git. Remember to move these dependencies to your gemspec before releasing
|
data/README.md
ADDED
@@ -0,0 +1,529 @@
|
|
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 use some of the new cool features in Ruby 2.7 while using 2.3.x?
|
4
|
+
Have some legacy code in Ruby 1.8 but can't live without `flat_map`?
|
5
|
+
|
6
|
+
This gem is for you!
|
7
|
+
|
8
|
+
The goal of 'backports' is to make it easier to write ruby code that runs
|
9
|
+
across different versions of Ruby.
|
10
|
+
|
11
|
+
Note: [Next major version (X-mas
|
12
|
+
2020)](https://github.com/marcandre/backports/issues/139) will drop support
|
13
|
+
for Ruby < 2.2.
|
14
|
+
|
15
|
+
## Loading backports
|
16
|
+
|
17
|
+
### Explicitly (recommended)
|
18
|
+
|
19
|
+
For example, if you want to use transform_values and transform_keys, even in
|
20
|
+
Ruby implementations that don't include it:
|
21
|
+
|
22
|
+
require 'backports/2.4.0/hash/transform_values'
|
23
|
+
require 'backports/2.5.0/hash/transform_keys'
|
24
|
+
|
25
|
+
This will enable Hash#transform_values and Hash#transform_keys, using the
|
26
|
+
native versions if available or otherwise provide a pure Ruby version.
|
27
|
+
|
28
|
+
### By Module
|
29
|
+
|
30
|
+
To bring all the backports for a given Class/Module, you can specify only that
|
31
|
+
Class:
|
32
|
+
|
33
|
+
require 'backports/2.3.0/hash'
|
34
|
+
|
35
|
+
This will make sure that Hash responds to dig, fetch_values, <, <=, >, >= and
|
36
|
+
to_proc
|
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
|
42
|
+
version of Ruby mostly up to Ruby 2.7.0's standards:
|
43
|
+
|
44
|
+
require 'backports/2.7.0'
|
45
|
+
|
46
|
+
This will bring in all the features of 1.8.7 and many features of Ruby 1.9.x
|
47
|
+
all the way up to Ruby 2.7.0 (for all versions of Ruby)!
|
48
|
+
|
49
|
+
You may `require 'backports/latest'` as a
|
50
|
+
shortcut to the latest Ruby version supported.
|
51
|
+
|
52
|
+
*Note*: For production / public gems, it is highly recommended you only require
|
53
|
+
the backports you need explicitly.
|
54
|
+
|
55
|
+
*Note*: Although I am a Ruby committer, this gem is a personal project and is
|
56
|
+
not endorsed by ruby-core.
|
57
|
+
|
58
|
+
## What's inside
|
59
|
+
|
60
|
+
Goals for backported features:
|
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 2.7 backports
|
113
|
+
|
114
|
+
#### Array
|
115
|
+
- `intersection`
|
116
|
+
|
117
|
+
#### Comparable
|
118
|
+
- `clamp` (with range)
|
119
|
+
|
120
|
+
#### Complex
|
121
|
+
- +<=>+
|
122
|
+
|
123
|
+
#### Enumerable
|
124
|
+
- `filter_map`
|
125
|
+
- `tally`
|
126
|
+
|
127
|
+
#### Enumerator
|
128
|
+
- `produce` (class method)
|
129
|
+
|
130
|
+
#### Time
|
131
|
+
- `floor`, `ceil`
|
132
|
+
|
133
|
+
## Ruby 2.6 backports
|
134
|
+
|
135
|
+
#### Array
|
136
|
+
- `difference`, `union`
|
137
|
+
- `to_h` (with block)
|
138
|
+
|
139
|
+
#### Enumerable
|
140
|
+
- `chain`
|
141
|
+
- `to_h` (with block)
|
142
|
+
|
143
|
+
#### Enumerator::Chain (use Enumerable#chain)
|
144
|
+
|
145
|
+
#### Hash
|
146
|
+
- `merge`, `merge!`/`update` (with multiple arguments)
|
147
|
+
- `to_h` (with block)
|
148
|
+
|
149
|
+
#### Kernel
|
150
|
+
- `then`
|
151
|
+
|
152
|
+
#### Method
|
153
|
+
- +<<+, +>>+
|
154
|
+
|
155
|
+
#### Proc
|
156
|
+
- +<<+, +>>+
|
157
|
+
|
158
|
+
#### Range
|
159
|
+
- `cover?` (with `Range` argument)
|
160
|
+
|
161
|
+
## Ruby 2.5 backports
|
162
|
+
|
163
|
+
#### Array
|
164
|
+
- `append`, `prepend`
|
165
|
+
|
166
|
+
#### Dir
|
167
|
+
- `children`, `each_child`
|
168
|
+
|
169
|
+
#### Enumerable
|
170
|
+
- `any?`, `all?`, `none?`, `one?` (with pattern argument)
|
171
|
+
|
172
|
+
#### Hash
|
173
|
+
- `slice`
|
174
|
+
- `transform_keys`
|
175
|
+
|
176
|
+
#### Integer
|
177
|
+
- `sqrt`
|
178
|
+
- `allbits?`, `anybits?` and `nobits?`
|
179
|
+
|
180
|
+
#### Kernel
|
181
|
+
- `yield_self`
|
182
|
+
|
183
|
+
#### Module
|
184
|
+
- `attr`, `attr_accessor`, `attr_reader`, `attr_writer` (now public)
|
185
|
+
- `define_method`, `alias_method`, `undef_method`, `remove_method` (now
|
186
|
+
public)
|
187
|
+
|
188
|
+
#### String
|
189
|
+
- `delete_prefix`, `delete_prefix!`
|
190
|
+
- `delete_suffix`, `delete_suffix!`
|
191
|
+
- `undump`
|
192
|
+
|
193
|
+
#### Struct
|
194
|
+
- `new` (with `keyword_init: true`)
|
195
|
+
|
196
|
+
## Ruby 2.4 backports
|
197
|
+
|
198
|
+
#### Comparable
|
199
|
+
- `clamp`
|
200
|
+
|
201
|
+
#### Enumerable
|
202
|
+
- `sum`
|
203
|
+
- `uniq`
|
204
|
+
|
205
|
+
#### Hash
|
206
|
+
- `compact`, `compact!`
|
207
|
+
- `transform_values`, `transform_values!`
|
208
|
+
|
209
|
+
#### Regexp
|
210
|
+
- `match?`
|
211
|
+
|
212
|
+
#### String
|
213
|
+
- `match?`
|
214
|
+
|
215
|
+
#### FalseClass, Fixnum, Float, NilClass, TrueClass
|
216
|
+
- `dup`
|
217
|
+
|
218
|
+
## Ruby 2.3 backports
|
219
|
+
|
220
|
+
#### Array
|
221
|
+
- `bsearch_index`
|
222
|
+
- `dig`
|
223
|
+
|
224
|
+
#### Enumerable
|
225
|
+
- `chunk_while`
|
226
|
+
- `grep_v`
|
227
|
+
|
228
|
+
#### Hash
|
229
|
+
- `dig`
|
230
|
+
- `fetch_values`
|
231
|
+
- `to_proc`
|
232
|
+
- <=, <, >=, >
|
233
|
+
|
234
|
+
#### Numeric
|
235
|
+
- `negative?`
|
236
|
+
- `positive?`
|
237
|
+
|
238
|
+
#### String
|
239
|
+
- unary + and -
|
240
|
+
|
241
|
+
#### Struct
|
242
|
+
- `dig`
|
243
|
+
|
244
|
+
## Ruby 2.2 backports
|
245
|
+
|
246
|
+
#### Enumerable
|
247
|
+
- `slice_after`
|
248
|
+
- `slice_when`
|
249
|
+
|
250
|
+
#### Float
|
251
|
+
- `prev_float`
|
252
|
+
- `next_float`
|
253
|
+
|
254
|
+
#### Kernel
|
255
|
+
- `itself`
|
256
|
+
|
257
|
+
#### Method
|
258
|
+
- `curry`
|
259
|
+
- `super_method`
|
260
|
+
|
261
|
+
#### String
|
262
|
+
- `unicode_normalize`
|
263
|
+
- `unicode_normalize!`
|
264
|
+
- `unicode_normalize?`
|
265
|
+
|
266
|
+
## Ruby 2.1 backports
|
267
|
+
|
268
|
+
#### Array
|
269
|
+
- `to_h`
|
270
|
+
|
271
|
+
#### Bignum
|
272
|
+
- `bit_length`
|
273
|
+
|
274
|
+
#### Enumerable
|
275
|
+
- `to_h`
|
276
|
+
|
277
|
+
#### Fixnum
|
278
|
+
- `bit_length`
|
279
|
+
|
280
|
+
#### Module
|
281
|
+
- `include` (now public)
|
282
|
+
|
283
|
+
## Ruby 2.0 backports
|
284
|
+
|
285
|
+
#### Array
|
286
|
+
- `bsearch`
|
287
|
+
|
288
|
+
#### Enumerable
|
289
|
+
- `lazy`
|
290
|
+
|
291
|
+
#### Enumerator::Lazy
|
292
|
+
- all methods
|
293
|
+
|
294
|
+
#### Hash
|
295
|
+
- `default_proc=` (with nil argument)
|
296
|
+
- `to_h`
|
297
|
+
|
298
|
+
#### `nil.to_h`
|
299
|
+
|
300
|
+
#### Range
|
301
|
+
- `bsearch`
|
302
|
+
|
303
|
+
#### Struct
|
304
|
+
- `to_h`
|
305
|
+
|
306
|
+
## Ruby 1.9.3 backports
|
307
|
+
|
308
|
+
#### File
|
309
|
+
- `NULL`
|
310
|
+
|
311
|
+
#### IO
|
312
|
+
- `advise` (acts as a noop)
|
313
|
+
- `write`, `binwrite`
|
314
|
+
|
315
|
+
#### String
|
316
|
+
- `byteslice`
|
317
|
+
- `prepend`
|
318
|
+
|
319
|
+
## Ruby 1.9.2 backports
|
320
|
+
|
321
|
+
#### Array
|
322
|
+
- `rotate, rotate!`
|
323
|
+
- `keep_if, select!`
|
324
|
+
- `product` (with block)
|
325
|
+
- `repeated_combination`, `repeated_permutation`
|
326
|
+
- `sort_by!`
|
327
|
+
- `uniq, uniq!` (with block)
|
328
|
+
|
329
|
+
#### Complex
|
330
|
+
- `to_r`
|
331
|
+
|
332
|
+
#### Dir
|
333
|
+
- `home`
|
334
|
+
|
335
|
+
#### Enumerable
|
336
|
+
- `chunk`
|
337
|
+
- `flat_map`, `collect_concat`
|
338
|
+
- `join`
|
339
|
+
- `slice_before`
|
340
|
+
|
341
|
+
#### Float::INFINITY, NAN
|
342
|
+
|
343
|
+
#### Hash
|
344
|
+
- `keep_if`, `select!`
|
345
|
+
|
346
|
+
#### Object
|
347
|
+
- `singleton_class`
|
348
|
+
|
349
|
+
#### Random (new class)
|
350
|
+
|
351
|
+
*Note*: The methods of `Random` can't be required individually; the class
|
352
|
+
can only be required whole with `require 'backports/1.9.2/random'`.
|
353
|
+
|
354
|
+
## Ruby 1.9.1 backports
|
355
|
+
|
356
|
+
Additionally, the following Ruby 1.9 features have been backported:
|
357
|
+
#### Array
|
358
|
+
- `try_convert`
|
359
|
+
- `sample`
|
360
|
+
|
361
|
+
#### Enumerable
|
362
|
+
- `each_with_object`
|
363
|
+
- `each_with_index` (with arguments)
|
364
|
+
|
365
|
+
#### Enumerator
|
366
|
+
- `new` (with block)
|
367
|
+
|
368
|
+
#### File
|
369
|
+
- `binread`
|
370
|
+
- `to_path`
|
371
|
+
- All class methods accepting filenames will accept files or anything
|
372
|
+
with a `#to_path` method.
|
373
|
+
- `File.open` accepts an options hash.
|
374
|
+
|
375
|
+
#### Float
|
376
|
+
- `round`
|
377
|
+
|
378
|
+
#### Hash
|
379
|
+
- `assoc`, `rassoc`
|
380
|
+
- `key`
|
381
|
+
- `try_convert`
|
382
|
+
- `default_proc=`
|
383
|
+
|
384
|
+
#### Integer
|
385
|
+
- `magnitude`
|
386
|
+
- `round`
|
387
|
+
|
388
|
+
#### IO
|
389
|
+
- `bin_read`
|
390
|
+
- `try_convert`
|
391
|
+
- `ungetbyte`
|
392
|
+
- `IO.open` accepts an options hash.
|
393
|
+
|
394
|
+
#### Kernel
|
395
|
+
- `require_relative`
|
396
|
+
|
397
|
+
#### Math
|
398
|
+
- `log` (with base)
|
399
|
+
- `log2`
|
400
|
+
|
401
|
+
#### Numeric
|
402
|
+
- `round`
|
403
|
+
|
404
|
+
#### Object
|
405
|
+
- `define_singleton_method`
|
406
|
+
- `public_method`
|
407
|
+
- `public_send`
|
408
|
+
|
409
|
+
#### Proc
|
410
|
+
- `yield`
|
411
|
+
- `lambda?`
|
412
|
+
- `curry`
|
413
|
+
- `===`
|
414
|
+
|
415
|
+
#### Range
|
416
|
+
- `cover?`
|
417
|
+
|
418
|
+
#### Regexp
|
419
|
+
- `try_convert`
|
420
|
+
|
421
|
+
#### String
|
422
|
+
- `ascii_only?`
|
423
|
+
- `chr`
|
424
|
+
- `clear`
|
425
|
+
- `codepoints`, `each_codepoint`
|
426
|
+
- `get_byte`, `set_byte`
|
427
|
+
- `ord`
|
428
|
+
- `try_convert`
|
429
|
+
|
430
|
+
`Enumerator` can be accessed directly (instead of `Enumerable::Enumerator`)
|
431
|
+
|
432
|
+
To include *only* these backports and those of the 1.8 line, `require
|
433
|
+
"backports/1.9.1"`.
|
434
|
+
|
435
|
+
Moreover, a pretty good imitation of `BasicObject` is available, but since it
|
436
|
+
is only an imitation, it must be required explicitly:
|
437
|
+
|
438
|
+
require 'backports/basic_object'
|
439
|
+
|
440
|
+
## Ruby 1.8.7
|
441
|
+
|
442
|
+
Complete Ruby 1.8.7 backporting (core language). Refer to the official list of
|
443
|
+
[changes](https://github.com/ruby/ruby/blob/ruby_1_8_7/NEWS). That's about 130
|
444
|
+
backports!
|
445
|
+
|
446
|
+
Only exceptions:
|
447
|
+
#### String#gsub (the form returning an enumerator)
|
448
|
+
#### GC.stress= (not implemented)
|
449
|
+
#### Array#choice (removed in 1.9, use 1.9.1's Array#sample instead)
|
450
|
+
|
451
|
+
## Libraries
|
452
|
+
|
453
|
+
Libraries were slowly being backported, but they are now available as separate gems.
|
454
|
+
|
455
|
+
The backports would be automatically used after requiring 'backports/std_lib' but this is now deprecated and discouraged.
|
456
|
+
|
457
|
+
The following libraries are up to date with Ruby 1.9.3:
|
458
|
+
|
459
|
+
#### Matrix
|
460
|
+
#### Prime
|
461
|
+
#### Set
|
462
|
+
|
463
|
+
The following library is to date with Ruby 2.0.0:
|
464
|
+
|
465
|
+
#### OpenStruct (ostruct)
|
466
|
+
|
467
|
+
I am aware of the following backport gem, which probably won't make it into
|
468
|
+
this gem:
|
469
|
+
|
470
|
+
#### Net::SMTP for Ruby 1.8.6:
|
471
|
+
[smtp_tls](http://seattlerb.rubyforge.org/smtp_tls/)
|
472
|
+
|
473
|
+
Requiring backports for a given version of Ruby will also load
|
474
|
+
'backports/std_lib'.
|
475
|
+
|
476
|
+
## Forcing incompatibilities
|
477
|
+
|
478
|
+
Some backports would create incompatibilities in their current Ruby version
|
479
|
+
but could be useful in some projects. It is possible to request such
|
480
|
+
incompatible changes. Backports currently supports the following:
|
481
|
+
|
482
|
+
#### Hash
|
483
|
+
- `select` (returns a Hash instead of an Array)
|
484
|
+
|
485
|
+
#### Enumerable / Array
|
486
|
+
- `map` (returns an enumerator when called without a block)
|
487
|
+
|
488
|
+
#### String
|
489
|
+
- `length`, `size` (for UTF-8 support)
|
490
|
+
|
491
|
+
These must be imported in addition to the backports gem, for example:
|
492
|
+
|
493
|
+
require "backports/force/hash_select"
|
494
|
+
{}.select{} # => {}, even in Ruby 1.8
|
495
|
+
|
496
|
+
## Thanks
|
497
|
+
|
498
|
+
Thanks for the bug reports and patches, in particular the repeat offenders:
|
499
|
+
|
500
|
+
#### Arto Bendiken ( [bendiken](http://github.com/bendiken) )
|
501
|
+
#### Konstantin Haase ( [rkh](https://github.com/rkh) )
|
502
|
+
#### Roger Pack ( [rdp](http://github.com/rdp) )
|
503
|
+
#### Victor Shepelev ( [zverok](http://github.com/zverok) )
|
504
|
+
|
505
|
+
## Contributing
|
506
|
+
|
507
|
+
The best way to submit a patch is to also submit a patch to
|
508
|
+
[ruby/spec](https://github.com/ruby/spec) and then a patch to backports that
|
509
|
+
make it pass the spec.
|
510
|
+
|
511
|
+
See below to test rubyspec. Note that only features missing from your Ruby
|
512
|
+
version are tested.
|
513
|
+
|
514
|
+
git submodule init && git submodule update # => pulls rubyspecs
|
515
|
+
bundle install
|
516
|
+
bundle exec rake spec[hash/slice] # => tests Hash#slice (must be in Ruby 2.4 or less)
|
517
|
+
bundle exec rake spec[hash/*] # => tests all backported Hash methods
|
518
|
+
bundle exec rake spec (or rake spec[*/*]) # => all rubyspecs for backported methods
|
519
|
+
|
520
|
+
Failures that are acceptable are added the to `tags` file.
|
521
|
+
|
522
|
+
# License
|
523
|
+
|
524
|
+
`backports` is released under the terms of the MIT License, see the included
|
525
|
+
LICENSE file.
|
526
|
+
|
527
|
+
Author
|
528
|
+
: Marc-André Lafortune
|
529
|
+
|