backports 3.15.0 → 3.24.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (505) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +846 -0
  3. data/Gemfile +6 -13
  4. data/README.md +706 -0
  5. data/SECURITY.md +5 -0
  6. data/backports.gemspec +6 -2
  7. data/lib/backports/1.8.7.rb +10 -2
  8. data/lib/backports/1.9.1.rb +6 -1
  9. data/lib/backports/1.9.2/stdlib/matrix.rb +5 -0
  10. data/lib/backports/1.9.2.rb +6 -1
  11. data/lib/backports/1.9.3.rb +6 -1
  12. data/lib/backports/2.0.0/range/size.rb +2 -0
  13. data/lib/backports/2.0.0.rb +7 -2
  14. data/lib/backports/2.1.0/module/singleton_class.rb +8 -0
  15. data/lib/backports/2.1.0.rb +2 -2
  16. data/lib/backports/2.2.0/enumerable/slice_after.rb +1 -1
  17. data/lib/backports/2.2.0/float/next_float.rb +1 -1
  18. data/lib/backports/2.2.0/float/prev_float.rb +1 -1
  19. data/lib/backports/2.2.0/method/super_method.rb +2 -2
  20. data/lib/backports/2.2.0/string/unicode_normalize.rb +3 -3
  21. data/lib/backports/2.2.0.rb +2 -2
  22. data/lib/backports/2.3.0/array/bsearch_index.rb +1 -1
  23. data/lib/backports/2.3.0/hash/lt.rb +1 -1
  24. data/lib/backports/2.3.0/hash/lte.rb +1 -1
  25. data/lib/backports/2.3.0/hash/to_proc.rb +1 -1
  26. data/lib/backports/2.3.0/queue/close.rb +48 -0
  27. data/lib/backports/2.3.0/string.rb +3 -0
  28. data/lib/backports/2.3.0/struct/dig.rb +3 -2
  29. data/lib/backports/2.3.0.rb +2 -2
  30. data/lib/backports/2.4.0/bignum/dup.rb +5 -0
  31. data/lib/backports/2.4.0/bignum.rb +3 -0
  32. data/lib/backports/2.4.0/enumerable/sum.rb +8 -4
  33. data/lib/backports/2.4.0/hash/transform_values.rb +2 -2
  34. data/lib/backports/2.4.0/string/unpack1.rb +7 -0
  35. data/lib/backports/2.4.0/true_class/dup.rb +0 -1
  36. data/lib/backports/2.4.0.rb +2 -2
  37. data/lib/backports/2.5.0/dir/children.rb +4 -0
  38. data/lib/backports/2.5.0/dir/each_child.rb +7 -0
  39. data/lib/backports/2.5.0/hash/transform_keys.rb +11 -4
  40. data/lib/backports/2.5.0/integer/sqrt.rb +2 -2
  41. data/lib/backports/2.5.0/module/alias_method.rb +0 -1
  42. data/lib/backports/2.5.0/string/undump.rb +5 -9
  43. data/lib/backports/2.5.0/struct/new.rb +1 -1
  44. data/lib/backports/2.5.0.rb +2 -2
  45. data/lib/backports/2.5.rb +1 -1
  46. data/lib/backports/2.6.0/array/difference.rb +7 -3
  47. data/lib/backports/2.6.0/enumerable/chain.rb +6 -1
  48. data/lib/backports/2.6.0/hash/to_h.rb +1 -1
  49. data/lib/backports/2.6.0/range/cover.rb +22 -0
  50. data/lib/backports/2.6.0/range.rb +3 -0
  51. data/lib/backports/2.6.0.rb +3 -3
  52. data/lib/backports/2.6.rb +1 -1
  53. data/lib/backports/2.7.0/array/intersection.rb +7 -0
  54. data/lib/backports/2.7.0/array.rb +3 -0
  55. data/lib/backports/2.7.0/comparable/clamp.rb +23 -0
  56. data/lib/backports/2.7.0/comparable.rb +3 -0
  57. data/lib/backports/2.7.0/complex/comparison.rb +13 -0
  58. data/lib/backports/2.7.0/complex.rb +3 -0
  59. data/lib/backports/2.7.0/enumerable/filter_map.rb +14 -0
  60. data/lib/backports/2.7.0/enumerable/tally.rb +11 -0
  61. data/lib/backports/2.7.0/enumerable.rb +3 -0
  62. data/lib/backports/2.7.0/enumerator/produce.rb +20 -0
  63. data/lib/backports/2.7.0/enumerator.rb +3 -0
  64. data/lib/backports/2.7.0/symbol/end_with.rb +9 -0
  65. data/lib/backports/2.7.0/symbol/start_with.rb +9 -0
  66. data/lib/backports/2.7.0/symbol.rb +3 -0
  67. data/lib/backports/2.7.0/time/ceil.rb +10 -0
  68. data/lib/backports/2.7.0/time/floor.rb +7 -0
  69. data/lib/backports/2.7.0.rb +3 -0
  70. data/lib/backports/2.7.rb +1 -0
  71. data/lib/backports/3.0.0/env/except.rb +10 -0
  72. data/lib/backports/3.0.0/env.rb +3 -0
  73. data/lib/backports/3.0.0/hash/except.rb +10 -0
  74. data/lib/backports/3.0.0/hash/transform_keys.rb +48 -0
  75. data/lib/backports/3.0.0/hash.rb +3 -0
  76. data/lib/backports/3.0.0/ractor.rb +19 -0
  77. data/lib/backports/3.0.0/symbol/name.rb +21 -0
  78. data/lib/backports/3.0.0/symbol.rb +3 -0
  79. data/lib/backports/3.0.0.rb +3 -0
  80. data/lib/backports/3.0.rb +1 -0
  81. data/lib/backports/3.1.0/array/intersect.rb +16 -0
  82. data/lib/backports/3.1.0/array.rb +3 -0
  83. data/lib/backports/3.1.0/class/subclasses.rb +11 -0
  84. data/lib/backports/3.1.0/enumerable/compact.rb +5 -0
  85. data/lib/backports/3.1.0/enumerable/tally.rb +18 -0
  86. data/lib/backports/3.1.0/enumerable.rb +3 -0
  87. data/lib/backports/3.1.0/file/dirname.rb +16 -0
  88. data/lib/backports/3.1.0/file.rb +3 -0
  89. data/lib/backports/3.1.0/integer/try_convert.rb +7 -0
  90. data/lib/backports/3.1.0/integer.rb +3 -0
  91. data/lib/backports/3.1.0/match_data/match.rb +5 -0
  92. data/lib/backports/3.1.0/match_data/match_length.rb +6 -0
  93. data/lib/backports/3.1.0/match_data.rb +3 -0
  94. data/lib/backports/3.1.0/struct/keyword_init.rb +5 -0
  95. data/lib/backports/3.1.0/struct.rb +3 -0
  96. data/lib/backports/3.1.0.rb +3 -0
  97. data/lib/backports/3.1.rb +1 -0
  98. data/lib/backports/3.2.0/class/attached_object.rb +10 -0
  99. data/lib/backports/3.2.0/class.rb +3 -0
  100. data/lib/backports/3.2.0/data.rb +144 -0
  101. data/lib/backports/3.2.0/enumerator/product.rb +64 -0
  102. data/lib/backports/3.2.0/enumerator.rb +3 -0
  103. data/lib/backports/3.2.0/hash/shift.rb +10 -0
  104. data/lib/backports/3.2.0/hash.rb +3 -0
  105. data/lib/backports/3.2.0/integer/ceildiv.rb +7 -0
  106. data/lib/backports/3.2.0/integer.rb +3 -0
  107. data/lib/backports/3.2.0/match_data/byteoffset.rb +12 -0
  108. data/lib/backports/3.2.0/match_data.rb +3 -0
  109. data/lib/backports/3.2.0.rb +3 -0
  110. data/lib/backports/3.2.rb +1 -0
  111. data/lib/backports/latest.rb +1 -1
  112. data/lib/backports/ractor/cloner.rb +103 -0
  113. data/lib/backports/ractor/errors.rb +20 -0
  114. data/lib/backports/ractor/filtered_queue.rb +205 -0
  115. data/lib/backports/ractor/queues.rb +66 -0
  116. data/lib/backports/ractor/ractor.rb +272 -0
  117. data/lib/backports/ractor/sharing.rb +97 -0
  118. data/lib/backports/rails/array.rb +4 -0
  119. data/lib/backports/rails/enumerable.rb +4 -0
  120. data/lib/backports/rails/hash.rb +4 -0
  121. data/lib/backports/rails/kernel.rb +4 -0
  122. data/lib/backports/rails/module.rb +4 -0
  123. data/lib/backports/rails/string.rb +4 -0
  124. data/lib/backports/std_lib.rb +3 -0
  125. data/lib/backports/tools/deprecation.rb +19 -0
  126. data/lib/backports/tools/require_relative_dir.rb +6 -1
  127. data/lib/backports/version.rb +1 -1
  128. data/lib/backports.rb +6 -0
  129. metadata +81 -488
  130. data/.document +0 -6
  131. data/.gitignore +0 -9
  132. data/.gitmodules +0 -6
  133. data/.irbrc +0 -3
  134. data/.travis.yml +0 -20
  135. data/CHANGELOG.rdoc +0 -479
  136. data/README.rdoc +0 -422
  137. data/Rakefile +0 -189
  138. data/default.mspec +0 -14
  139. data/frozen_old_spec/tags/1.8.6/core/argf/each_line_spec.rb +0 -6
  140. data/frozen_old_spec/tags/1.8.6/core/argf/each_spec.rb +0 -6
  141. data/frozen_old_spec/tags/1.8.6/core/argf/lines_spec.rb +0 -6
  142. data/frozen_old_spec/tags/1.8.6/core/array/append_spec.rb +0 -1
  143. data/frozen_old_spec/tags/1.8.6/core/array/collect_spec.rb +0 -7
  144. data/frozen_old_spec/tags/1.8.6/core/array/rotate_spec.rb +0 -2
  145. data/frozen_old_spec/tags/1.8.6/core/array/uniq_spec.rb +0 -3
  146. data/frozen_old_spec/tags/1.8.6/core/complex/to_r_spec.rb +0 -3
  147. data/frozen_old_spec/tags/1.8.6/core/enumerable/all_spec.rb +0 -1
  148. data/frozen_old_spec/tags/1.8.6/core/enumerable/any_spec.rb +0 -2
  149. data/frozen_old_spec/tags/1.8.6/core/enumerable/each_entry_spec.rb +0 -1
  150. data/frozen_old_spec/tags/1.8.6/core/enumerable/none_spec.rb +0 -1
  151. data/frozen_old_spec/tags/1.8.6/core/enumerable/one_spec.rb +0 -1
  152. data/frozen_old_spec/tags/1.8.6/core/enumerator/next_spec.rb +0 -1
  153. data/frozen_old_spec/tags/1.8.6/core/env/to_h_spec.rb +0 -2
  154. data/frozen_old_spec/tags/1.8.6/core/file/join_spec.rb +0 -3
  155. data/frozen_old_spec/tags/1.8.6/core/file/lchmod_spec.rb +0 -2
  156. data/frozen_old_spec/tags/1.8.6/core/file/new_spec.rb +0 -2
  157. data/frozen_old_spec/tags/1.8.6/core/file/open_spec.rb +0 -13
  158. data/frozen_old_spec/tags/1.8.6/core/file/to_path_spec.rb +0 -1
  159. data/frozen_old_spec/tags/1.8.6/core/fixnum/fdiv_spec.rb +0 -1
  160. data/frozen_old_spec/tags/1.8.6/core/gc/stress_spec.rb +0 -2
  161. data/frozen_old_spec/tags/1.8.6/core/hash/assoc_spec.rb +0 -1
  162. data/frozen_old_spec/tags/1.8.6/core/hash/constructor_spec.rb +0 -3
  163. data/frozen_old_spec/tags/1.8.6/core/hash/default_proc_spec.rb +0 -3
  164. data/frozen_old_spec/tags/1.8.6/core/hash/delete_if_spec.rb +0 -1
  165. data/frozen_old_spec/tags/1.8.6/core/hash/each_pair_spec.rb +0 -1
  166. data/frozen_old_spec/tags/1.8.6/core/hash/eql_spec.rb +0 -3
  167. data/frozen_old_spec/tags/1.8.6/core/hash/hash_spec.rb +0 -3
  168. data/frozen_old_spec/tags/1.8.6/core/hash/keep_if_spec.rb +0 -2
  169. data/frozen_old_spec/tags/1.8.6/core/hash/rassoc_spec.rb +0 -1
  170. data/frozen_old_spec/tags/1.8.6/core/hash/reject_spec.rb +0 -2
  171. data/frozen_old_spec/tags/1.8.6/core/hash/select_spec.rb +0 -8
  172. data/frozen_old_spec/tags/1.8.6/core/integer/round_spec.rb +0 -2
  173. data/frozen_old_spec/tags/1.8.6/core/io/binread_spec.rb +0 -7
  174. data/frozen_old_spec/tags/1.8.6/core/io/chars_spec.rb +0 -1
  175. data/frozen_old_spec/tags/1.8.6/core/io/each_char_spec.rb +0 -1
  176. data/frozen_old_spec/tags/1.8.6/core/io/lines_spec.rb +0 -1
  177. data/frozen_old_spec/tags/1.8.6/core/io/open_spec.rb +0 -24
  178. data/frozen_old_spec/tags/1.8.6/core/io/ungetbyte_spec.rb +0 -4
  179. data/frozen_old_spec/tags/1.8.6/core/io/write_spec.rb +0 -5
  180. data/frozen_old_spec/tags/1.8.6/core/kernel/__callee___spec.rb +0 -6
  181. data/frozen_old_spec/tags/1.8.6/core/kernel/__method___spec.rb +0 -1
  182. data/frozen_old_spec/tags/1.8.6/core/kernel/define_singleton_method_spec.rb +0 -2
  183. data/frozen_old_spec/tags/1.8.6/core/kernel/public_method_spec.rb +0 -2
  184. data/frozen_old_spec/tags/1.8.6/core/kernel/require_relative_spec.rb +0 -3
  185. data/frozen_old_spec/tags/1.8.6/core/math/log2_spec.rb +0 -6
  186. data/frozen_old_spec/tags/1.8.6/core/math/log_spec.rb +0 -3
  187. data/frozen_old_spec/tags/1.8.6/core/module/alias_method_spec.rb +0 -1
  188. data/frozen_old_spec/tags/1.8.6/core/module/attr_accessor_spec.rb +0 -2
  189. data/frozen_old_spec/tags/1.8.6/core/module/attr_reader_spec.rb +0 -2
  190. data/frozen_old_spec/tags/1.8.6/core/module/attr_spec.rb +0 -1
  191. data/frozen_old_spec/tags/1.8.6/core/module/attr_writer_spec.rb +0 -2
  192. data/frozen_old_spec/tags/1.8.6/core/module/class_exec_spec.rb +0 -2
  193. data/frozen_old_spec/tags/1.8.6/core/module/define_method_spec.rb +0 -1
  194. data/frozen_old_spec/tags/1.8.6/core/module/module_exec_spec.rb +0 -2
  195. data/frozen_old_spec/tags/1.8.6/core/module/remove_method_spec.rb +0 -1
  196. data/frozen_old_spec/tags/1.8.6/core/module/undef_method_spec.rb +0 -1
  197. data/frozen_old_spec/tags/1.8.6/core/nil/dup_spec.rb +0 -1
  198. data/frozen_old_spec/tags/1.8.6/core/numeric/step_spec.rb +0 -12
  199. data/frozen_old_spec/tags/1.8.6/core/proc/curry_spec.rb +0 -4
  200. data/frozen_old_spec/tags/1.8.6/core/range/step_spec.rb +0 -12
  201. data/frozen_old_spec/tags/1.8.6/core/string/getbyte_spec.rb +0 -6
  202. data/frozen_old_spec/tags/1.8.6/core/string/partition_spec.rb +0 -1
  203. data/frozen_old_spec/tags/1.8.6/core/string/prepend_spec.rb +0 -1
  204. data/frozen_old_spec/tags/1.8.6/core/string/rpartition_spec.rb +0 -1
  205. data/frozen_old_spec/tags/1.8.6/core/string/setbyte_spec.rb +0 -5
  206. data/frozen_old_spec/tags/1.8.6/core/string/upto_spec.rb +0 -1
  207. data/frozen_old_spec/tags/1.8.6/core/symbol/capitalize_spec.rb +0 -3
  208. data/frozen_old_spec/tags/1.8.6/core/symbol/comparison_spec.rb +0 -1
  209. data/frozen_old_spec/tags/1.8.6/core/symbol/downcase_spec.rb +0 -2
  210. data/frozen_old_spec/tags/1.8.6/core/symbol/element_reference_spec.rb +0 -4
  211. data/frozen_old_spec/tags/1.8.6/core/symbol/empty_spec.rb +0 -1
  212. data/frozen_old_spec/tags/1.8.6/core/symbol/match_spec.rb +0 -2
  213. data/frozen_old_spec/tags/1.8.6/core/symbol/swapcase_spec.rb +0 -2
  214. data/frozen_old_spec/tags/1.8.6/core/symbol/to_proc_spec.rb +0 -1
  215. data/frozen_old_spec/tags/1.8.6/core/symbol/upcase_spec.rb +0 -1
  216. data/frozen_old_spec/tags/1.8.7/core/array/append_spec.rb +0 -1
  217. data/frozen_old_spec/tags/1.8.7/core/array/keep_if_spec.rb +0 -2
  218. data/frozen_old_spec/tags/1.8.7/core/array/rotate_spec.rb +0 -2
  219. data/frozen_old_spec/tags/1.8.7/core/array/select_spec.rb +0 -2
  220. data/frozen_old_spec/tags/1.8.7/core/array/uniq_spec.rb +0 -3
  221. data/frozen_old_spec/tags/1.8.7/core/complex/to_r_spec.rb +0 -3
  222. data/frozen_old_spec/tags/1.8.7/core/enumerable/all_spec.rb +0 -1
  223. data/frozen_old_spec/tags/1.8.7/core/enumerable/any_spec.rb +0 -2
  224. data/frozen_old_spec/tags/1.8.7/core/enumerable/collect_concat_spec.rb +0 -1
  225. data/frozen_old_spec/tags/1.8.7/core/enumerable/flat_map_spec.rb +0 -1
  226. data/frozen_old_spec/tags/1.8.7/core/enumerable/none_spec.rb +0 -1
  227. data/frozen_old_spec/tags/1.8.7/core/enumerable/one_spec.rb +0 -1
  228. data/frozen_old_spec/tags/1.8.7/core/env/to_h_spec.rb +0 -2
  229. data/frozen_old_spec/tags/1.8.7/core/file/lchmod_spec.rb +0 -2
  230. data/frozen_old_spec/tags/1.8.7/core/file/new_spec.rb +0 -1
  231. data/frozen_old_spec/tags/1.8.7/core/file/open_spec.rb +0 -5
  232. data/frozen_old_spec/tags/1.8.7/core/file/readlink_spec.rb +0 -6
  233. data/frozen_old_spec/tags/1.8.7/core/file/to_path_spec.rb +0 -1
  234. data/frozen_old_spec/tags/1.8.7/core/hash/assoc_spec.rb +0 -1
  235. data/frozen_old_spec/tags/1.8.7/core/hash/default_proc_spec.rb +0 -3
  236. data/frozen_old_spec/tags/1.8.7/core/hash/keep_if_spec.rb +0 -2
  237. data/frozen_old_spec/tags/1.8.7/core/hash/merge_spec.rb +0 -3
  238. data/frozen_old_spec/tags/1.8.7/core/hash/rassoc_spec.rb +0 -1
  239. data/frozen_old_spec/tags/1.8.7/core/hash/select_spec.rb +0 -1
  240. data/frozen_old_spec/tags/1.8.7/core/hash/to_h_spec.rb +0 -1
  241. data/frozen_old_spec/tags/1.8.7/core/hash/update_spec.rb +0 -3
  242. data/frozen_old_spec/tags/1.8.7/core/integer/round_spec.rb +0 -2
  243. data/frozen_old_spec/tags/1.8.7/core/io/binread_spec.rb +0 -7
  244. data/frozen_old_spec/tags/1.8.7/core/io/open_spec.rb +0 -32
  245. data/frozen_old_spec/tags/1.8.7/core/io/ungetbyte_spec.rb +0 -4
  246. data/frozen_old_spec/tags/1.8.7/core/io/write_spec.rb +0 -5
  247. data/frozen_old_spec/tags/1.8.7/core/kernel/__callee___spec.rb +0 -6
  248. data/frozen_old_spec/tags/1.8.7/core/kernel/define_singleton_method_spec.rb +0 -2
  249. data/frozen_old_spec/tags/1.8.7/core/kernel/public_method_spec.rb +0 -1
  250. data/frozen_old_spec/tags/1.8.7/core/kernel/require_relative_spec.rb +0 -3
  251. data/frozen_old_spec/tags/1.8.7/core/math/log2_spec.rb +0 -6
  252. data/frozen_old_spec/tags/1.8.7/core/math/log_spec.rb +0 -3
  253. data/frozen_old_spec/tags/1.8.7/core/module/alias_method_spec.rb +0 -7
  254. data/frozen_old_spec/tags/1.8.7/core/module/attr_accessor_spec.rb +0 -2
  255. data/frozen_old_spec/tags/1.8.7/core/module/attr_reader_spec.rb +0 -2
  256. data/frozen_old_spec/tags/1.8.7/core/module/attr_spec.rb +0 -2
  257. data/frozen_old_spec/tags/1.8.7/core/module/attr_writer_spec.rb +0 -2
  258. data/frozen_old_spec/tags/1.8.7/core/module/define_method_spec.rb +0 -1
  259. data/frozen_old_spec/tags/1.8.7/core/module/include_spec.rb +0 -3
  260. data/frozen_old_spec/tags/1.8.7/core/module/remove_method_spec.rb +0 -3
  261. data/frozen_old_spec/tags/1.8.7/core/module/undef_method_spec.rb +0 -3
  262. data/frozen_old_spec/tags/1.8.7/core/nil/dup_spec.rb +0 -1
  263. data/frozen_old_spec/tags/1.8.7/core/proc/curry_spec.rb +0 -3
  264. data/frozen_old_spec/tags/1.8.7/core/proc/yield_spec.rb +0 -4
  265. data/frozen_old_spec/tags/1.8.7/core/range/size_spec.rb +0 -1
  266. data/frozen_old_spec/tags/1.8.7/core/string/getbyte_spec.rb +0 -5
  267. data/frozen_old_spec/tags/1.8.7/core/string/prepend_spec.rb +0 -1
  268. data/frozen_old_spec/tags/1.8.7/core/string/setbyte_spec.rb +0 -5
  269. data/frozen_old_spec/tags/1.8.7/core/struct/new_spec.rb +0 -3
  270. data/frozen_old_spec/tags/1.8.7/core/symbol/capitalize_spec.rb +0 -3
  271. data/frozen_old_spec/tags/1.8.7/core/symbol/comparison_spec.rb +0 -1
  272. data/frozen_old_spec/tags/1.8.7/core/symbol/downcase_spec.rb +0 -2
  273. data/frozen_old_spec/tags/1.8.7/core/symbol/element_reference_spec.rb +0 -4
  274. data/frozen_old_spec/tags/1.8.7/core/symbol/empty_spec.rb +0 -1
  275. data/frozen_old_spec/tags/1.8.7/core/symbol/match_spec.rb +0 -2
  276. data/frozen_old_spec/tags/1.8.7/core/symbol/swapcase_spec.rb +0 -2
  277. data/frozen_old_spec/tags/1.8.7/core/symbol/upcase_spec.rb +0 -1
  278. data/frozen_old_spec/tags/1.9.1/core/array/append_spec.rb +0 -1
  279. data/frozen_old_spec/tags/1.9.1/core/array/rotate_spec.rb +0 -1
  280. data/frozen_old_spec/tags/1.9.1/core/enumerable/all_spec.rb +0 -1
  281. data/frozen_old_spec/tags/1.9.1/core/enumerable/any_spec.rb +0 -2
  282. data/frozen_old_spec/tags/1.9.1/core/enumerable/none_spec.rb +0 -1
  283. data/frozen_old_spec/tags/1.9.1/core/enumerable/one_spec.rb +0 -1
  284. data/frozen_old_spec/tags/1.9.1/core/env/to_h_spec.rb +0 -2
  285. data/frozen_old_spec/tags/1.9.1/core/hash/default_proc_spec.rb +0 -1
  286. data/frozen_old_spec/tags/1.9.1/core/io/write_spec.rb +0 -2
  287. data/frozen_old_spec/tags/1.9.1/core/module/alias_method_spec.rb +0 -4
  288. data/frozen_old_spec/tags/1.9.1/core/module/attr_accessor_spec.rb +0 -2
  289. data/frozen_old_spec/tags/1.9.1/core/module/attr_reader_spec.rb +0 -2
  290. data/frozen_old_spec/tags/1.9.1/core/module/attr_spec.rb +0 -1
  291. data/frozen_old_spec/tags/1.9.1/core/module/attr_writer_spec.rb +0 -2
  292. data/frozen_old_spec/tags/1.9.1/core/module/define_method_spec.rb +0 -3
  293. data/frozen_old_spec/tags/1.9.1/core/module/remove_method_spec.rb +0 -1
  294. data/frozen_old_spec/tags/1.9.1/core/module/undef_method_spec.rb +0 -1
  295. data/frozen_old_spec/tags/1.9.1/core/nil/dup_spec.rb +0 -1
  296. data/frozen_old_spec/tags/1.9.2/core/array/append_spec.rb +0 -1
  297. data/frozen_old_spec/tags/1.9.2/core/enumerable/all_spec.rb +0 -1
  298. data/frozen_old_spec/tags/1.9.2/core/enumerable/any_spec.rb +0 -2
  299. data/frozen_old_spec/tags/1.9.2/core/enumerable/none_spec.rb +0 -1
  300. data/frozen_old_spec/tags/1.9.2/core/enumerable/one_spec.rb +0 -1
  301. data/frozen_old_spec/tags/1.9.2/core/io/write_spec.rb +0 -3
  302. data/frozen_old_spec/tags/1.9.2/core/module/alias_method_spec.rb +0 -4
  303. data/frozen_old_spec/tags/1.9.2/core/module/attr_accessor_spec.rb +0 -2
  304. data/frozen_old_spec/tags/1.9.2/core/module/attr_reader_spec.rb +0 -2
  305. data/frozen_old_spec/tags/1.9.2/core/module/attr_spec.rb +0 -1
  306. data/frozen_old_spec/tags/1.9.2/core/module/attr_writer_spec.rb +0 -2
  307. data/frozen_old_spec/tags/1.9.2/core/module/define_method_spec.rb +0 -3
  308. data/frozen_old_spec/tags/1.9.2/core/module/remove_method_spec.rb +0 -1
  309. data/frozen_old_spec/tags/1.9.2/core/module/undef_method_spec.rb +0 -1
  310. data/frozen_old_spec/tags/1.9.2/core/nil/dup_spec.rb +0 -1
  311. data/frozen_old_spec/tags/1.9.3/core/enumerable/any_spec.rb +0 -1
  312. data/frozen_old_spec/tags/1.9.3/core/module/alias_method_spec.rb +0 -4
  313. data/frozen_old_spec/tags/1.9.3/core/module/attr_accessor_spec.rb +0 -1
  314. data/frozen_old_spec/tags/1.9.3/core/module/attr_reader_spec.rb +0 -1
  315. data/frozen_old_spec/tags/1.9.3/core/module/attr_spec.rb +0 -1
  316. data/frozen_old_spec/tags/1.9.3/core/module/attr_writer_spec.rb +0 -1
  317. data/frozen_old_spec/tags/1.9.3/core/module/define_method_spec.rb +0 -3
  318. data/frozen_old_spec/tags/1.9.3/core/module/remove_method_spec.rb +0 -1
  319. data/frozen_old_spec/tags/1.9.3/core/module/undef_method_spec.rb +0 -1
  320. data/frozen_old_spec/tags/2.0.0/core/enumerable/any_spec.rb +0 -1
  321. data/frozen_old_spec/tags/2.0.0/core/module/alias_method_spec.rb +0 -1
  322. data/frozen_old_spec/tags/2.0.0/core/module/attr_accessor_spec.rb +0 -2
  323. data/frozen_old_spec/tags/2.0.0/core/module/attr_reader_spec.rb +0 -2
  324. data/frozen_old_spec/tags/2.0.0/core/module/attr_spec.rb +0 -1
  325. data/frozen_old_spec/tags/2.0.0/core/module/attr_writer_spec.rb +0 -2
  326. data/frozen_old_spec/tags/2.0.0/core/module/define_method_spec.rb +0 -2
  327. data/frozen_old_spec/tags/2.0.0/core/module/remove_method_spec.rb +0 -1
  328. data/frozen_old_spec/tags/2.0.0/core/module/undef_method_spec.rb +0 -1
  329. data/frozen_old_spec/tags/2.0.0/core/nil/dup_spec.rb +0 -1
  330. data/frozen_old_spec/tags/2.0.0/core/struct/new_spec.rb +0 -1
  331. data/frozen_old_spec/tags/2.1.0/core/enumerable/any_spec.rb +0 -1
  332. data/frozen_old_spec/tags/2.1.0/core/module/alias_method_spec.rb +0 -1
  333. data/frozen_old_spec/tags/2.1.0/core/module/attr_accessor_spec.rb +0 -2
  334. data/frozen_old_spec/tags/2.1.0/core/module/attr_reader_spec.rb +0 -2
  335. data/frozen_old_spec/tags/2.1.0/core/module/attr_spec.rb +0 -1
  336. data/frozen_old_spec/tags/2.1.0/core/module/attr_writer_spec.rb +0 -2
  337. data/frozen_old_spec/tags/2.1.0/core/module/define_method_spec.rb +0 -2
  338. data/frozen_old_spec/tags/2.1.0/core/module/remove_method_spec.rb +0 -1
  339. data/frozen_old_spec/tags/2.1.0/core/module/undef_method_spec.rb +0 -1
  340. data/frozen_old_spec/tags/2.1.0/core/nil/dup_spec.rb +0 -1
  341. data/frozen_old_spec/tags/2.1.0/core/struct/new_spec.rb +0 -1
  342. data/frozen_old_spec/tags/2.2.0/core/enumerable/any_spec.rb +0 -1
  343. data/frozen_old_spec/tags/2.2.0/core/module/alias_method_spec.rb +0 -1
  344. data/frozen_old_spec/tags/2.2.0/core/module/attr_accessor_spec.rb +0 -2
  345. data/frozen_old_spec/tags/2.2.0/core/module/attr_reader_spec.rb +0 -2
  346. data/frozen_old_spec/tags/2.2.0/core/module/attr_spec.rb +0 -1
  347. data/frozen_old_spec/tags/2.2.0/core/module/attr_writer_spec.rb +0 -2
  348. data/frozen_old_spec/tags/2.2.0/core/module/define_method_spec.rb +0 -1
  349. data/frozen_old_spec/tags/2.2.0/core/module/remove_method_spec.rb +0 -1
  350. data/frozen_old_spec/tags/2.2.0/core/module/undef_method_spec.rb +0 -1
  351. data/frozen_old_spec/tags/2.2.0/core/nil/dup_spec.rb +0 -1
  352. data/frozen_old_spec/tags/2.2.0/core/struct/new_spec.rb +0 -1
  353. data/frozen_old_spec/tags/2.3.0/core/enumerable/any_spec.rb +0 -1
  354. data/frozen_old_spec/tags/2.3.0/core/module/alias_method_spec.rb +0 -1
  355. data/frozen_old_spec/tags/2.3.0/core/module/attr_accessor_spec.rb +0 -2
  356. data/frozen_old_spec/tags/2.3.0/core/module/attr_reader_spec.rb +0 -2
  357. data/frozen_old_spec/tags/2.3.0/core/module/attr_spec.rb +0 -1
  358. data/frozen_old_spec/tags/2.3.0/core/module/attr_writer_spec.rb +0 -2
  359. data/frozen_old_spec/tags/2.3.0/core/module/define_method_spec.rb +0 -1
  360. data/frozen_old_spec/tags/2.3.0/core/module/remove_method_spec.rb +0 -1
  361. data/frozen_old_spec/tags/2.3.0/core/module/undef_method_spec.rb +0 -1
  362. data/frozen_old_spec/tags/2.3.0/core/nil/dup_spec.rb +0 -1
  363. data/frozen_old_spec/tags/2.3.0/core/struct/new_spec.rb +0 -1
  364. data/frozen_old_spec/tags/2.3.5/core/struct/new_spec.rb +0 -1
  365. data/frozen_old_spec/tags/2.4.0/core/enumerable/any_spec.rb +0 -1
  366. data/frozen_old_spec/tags/2.4.0/core/module/alias_method_spec.rb +0 -1
  367. data/frozen_old_spec/tags/2.4.0/core/module/attr_accessor_spec.rb +0 -2
  368. data/frozen_old_spec/tags/2.4.0/core/module/attr_reader_spec.rb +0 -2
  369. data/frozen_old_spec/tags/2.4.0/core/module/attr_spec.rb +0 -1
  370. data/frozen_old_spec/tags/2.4.0/core/module/attr_writer_spec.rb +0 -2
  371. data/frozen_old_spec/tags/2.4.0/core/module/define_method_spec.rb +0 -1
  372. data/frozen_old_spec/tags/2.4.0/core/module/remove_method_spec.rb +0 -1
  373. data/frozen_old_spec/tags/2.4.0/core/module/undef_method_spec.rb +0 -1
  374. data/frozen_old_spec/tags/2.4.0/core/nil/dup_spec.rb +0 -1
  375. data/frozen_old_spec/tags/2.4.0/core/struct/new_spec.rb +0 -1
  376. data/frozen_old_spec/tags/2.5.0/core/enumerable/any_spec.rb +0 -1
  377. data/frozen_old_spec/tags/2.5.0/core/module/alias_method_spec.rb +0 -1
  378. data/frozen_old_spec/tags/2.5.0/core/module/attr_accessor_spec.rb +0 -2
  379. data/frozen_old_spec/tags/2.5.0/core/module/attr_reader_spec.rb +0 -2
  380. data/frozen_old_spec/tags/2.5.0/core/module/attr_spec.rb +0 -1
  381. data/frozen_old_spec/tags/2.5.0/core/module/attr_writer_spec.rb +0 -2
  382. data/frozen_old_spec/tags/2.5.0/core/module/define_method_spec.rb +0 -1
  383. data/frozen_old_spec/tags/2.5.0/core/module/remove_method_spec.rb +0 -1
  384. data/frozen_old_spec/tags/2.5.0/core/module/undef_method_spec.rb +0 -1
  385. data/frozen_old_spec/tags/2.5.0/core/nil/dup_spec.rb +0 -1
  386. data/frozen_old_spec/tags/2.5.0/core/struct/new_spec.rb +0 -1
  387. data/set_version/1.8.7.rb +0 -1
  388. data/set_version/1.9.1.rb +0 -1
  389. data/set_version/1.9.2.rb +0 -1
  390. data/set_version/1.9.3.rb +0 -1
  391. data/set_version/2.0.0.rb +0 -1
  392. data/set_version/2.1.0.rb +0 -1
  393. data/set_version/2.2.0.rb +0 -1
  394. data/set_version/2.3.0.rb +0 -1
  395. data/set_version/2.4.0.rb +0 -1
  396. data/set_version/2.5.0.rb +0 -1
  397. data/set_version/2.6.0.rb +0 -1
  398. data/set_version/setter.rb +0 -22
  399. data/spec/tags/1.8.7/core/array/to_h_spec.rb +0 -3
  400. data/spec/tags/1.8.7/core/enumerable/to_h_spec.rb +0 -2
  401. data/spec/tags/1.8.7/core/module/attr_spec.rb +0 -1
  402. data/spec/tags/1.8.7/core/module/include_spec.rb +0 -1
  403. data/spec/tags/1.9.1/core/array/bsearch_index_spec.rb +0 -1
  404. data/spec/tags/1.9.1/core/array/rotate_spec.rb +0 -1
  405. data/spec/tags/1.9.1/core/dir/each_child_spec.rb +0 -1
  406. data/spec/tags/1.9.1/core/env/to_h_spec.rb +0 -2
  407. data/spec/tags/1.9.1/core/hash/default_proc_spec.rb +0 -1
  408. data/spec/tags/1.9.1/core/hash/slice_spec.rb +0 -1
  409. data/spec/tags/1.9.1/core/hash/transform_keys_spec.rb +0 -2
  410. data/spec/tags/1.9.1/core/hash/transform_values_spec.rb +0 -2
  411. data/spec/tags/1.9.1/core/io/write_spec.rb +0 -3
  412. data/spec/tags/1.9.1/core/kernel/yield_self_spec.rb +0 -1
  413. data/spec/tags/1.9.1/core/method/curry_spec.rb +0 -1
  414. data/spec/tags/1.9.1/core/module/alias_method_spec.rb +0 -3
  415. data/spec/tags/1.9.1/core/module/attr_accessor_spec.rb +0 -1
  416. data/spec/tags/1.9.1/core/module/attr_reader_spec.rb +0 -1
  417. data/spec/tags/1.9.1/core/module/attr_spec.rb +0 -1
  418. data/spec/tags/1.9.1/core/module/attr_writer_spec.rb +0 -1
  419. data/spec/tags/1.9.1/core/module/define_method_spec.rb +0 -7
  420. data/spec/tags/1.9.1/core/string/uplus_spec.rb +0 -1
  421. data/spec/tags/1.9.1/core/struct/new_spec.rb +0 -2
  422. data/spec/tags/1.9.2/core/array/bsearch_index_spec.rb +0 -1
  423. data/spec/tags/1.9.2/core/array/to_h_spec.rb +0 -3
  424. data/spec/tags/1.9.2/core/dir/each_child_spec.rb +0 -1
  425. data/spec/tags/1.9.2/core/enumerable/to_h_spec.rb +0 -2
  426. data/spec/tags/1.9.2/core/hash/slice_spec.rb +0 -1
  427. data/spec/tags/1.9.2/core/hash/to_h_spec.rb +0 -3
  428. data/spec/tags/1.9.2/core/hash/transform_keys_spec.rb +0 -2
  429. data/spec/tags/1.9.2/core/hash/transform_values_spec.rb +0 -2
  430. data/spec/tags/1.9.2/core/io/write_spec.rb +0 -3
  431. data/spec/tags/1.9.2/core/kernel/then_spec.rb +0 -1
  432. data/spec/tags/1.9.2/core/kernel/yield_self_spec.rb +0 -1
  433. data/spec/tags/1.9.2/core/method/curry_spec.rb +0 -1
  434. data/spec/tags/1.9.2/core/module/alias_method_spec.rb +0 -3
  435. data/spec/tags/1.9.2/core/module/attr_accessor_spec.rb +0 -1
  436. data/spec/tags/1.9.2/core/module/attr_reader_spec.rb +0 -1
  437. data/spec/tags/1.9.2/core/module/attr_writer_spec.rb +0 -1
  438. data/spec/tags/1.9.2/core/module/define_method_spec.rb +0 -7
  439. data/spec/tags/1.9.2/core/module/include_spec.rb +0 -1
  440. data/spec/tags/1.9.2/core/string/uplus_spec.rb +0 -1
  441. data/spec/tags/1.9.2/core/struct/new_spec.rb +0 -2
  442. data/spec/tags/1.9.3/core/array/bsearch_index_spec.rb +0 -1
  443. data/spec/tags/1.9.3/core/dir/each_child_spec.rb +0 -1
  444. data/spec/tags/1.9.3/core/hash/slice_spec.rb +0 -1
  445. data/spec/tags/1.9.3/core/hash/to_h_spec.rb +0 -3
  446. data/spec/tags/1.9.3/core/hash/transform_keys_spec.rb +0 -2
  447. data/spec/tags/1.9.3/core/hash/transform_values_spec.rb +0 -2
  448. data/spec/tags/1.9.3/core/io/write_spec.rb +0 -3
  449. data/spec/tags/1.9.3/core/kernel/yield_self_spec.rb +0 -1
  450. data/spec/tags/1.9.3/core/method/curry_spec.rb +0 -1
  451. data/spec/tags/1.9.3/core/module/alias_method_spec.rb +0 -3
  452. data/spec/tags/1.9.3/core/module/attr_accessor_spec.rb +0 -1
  453. data/spec/tags/1.9.3/core/module/attr_reader_spec.rb +0 -1
  454. data/spec/tags/1.9.3/core/module/attr_writer_spec.rb +0 -1
  455. data/spec/tags/1.9.3/core/module/define_method_spec.rb +0 -7
  456. data/spec/tags/1.9.3/core/module/include_spec.rb +0 -1
  457. data/spec/tags/1.9.3/core/string/uplus_spec.rb +0 -1
  458. data/spec/tags/1.9.3/core/struct/new_spec.rb +0 -2
  459. data/spec/tags/2.0.0/core/array/to_h_spec.rb +0 -3
  460. data/spec/tags/2.0.0/core/enumerable/to_h_spec.rb +0 -2
  461. data/spec/tags/2.0.0/core/hash/slice_spec.rb +0 -1
  462. data/spec/tags/2.0.0/core/hash/to_h_spec.rb +0 -3
  463. data/spec/tags/2.0.0/core/module/attr_accessor_spec.rb +0 -1
  464. data/spec/tags/2.0.0/core/module/attr_reader_spec.rb +0 -1
  465. data/spec/tags/2.0.0/core/module/attr_spec.rb +0 -1
  466. data/spec/tags/2.0.0/core/module/attr_writer_spec.rb +0 -1
  467. data/spec/tags/2.0.0/core/module/define_method_spec.rb +0 -4
  468. data/spec/tags/2.0.0/core/module/include_spec.rb +0 -1
  469. data/spec/tags/2.0.0/core/string/uplus_spec.rb +0 -1
  470. data/spec/tags/2.0.0/core/struct/new_spec.rb +0 -1
  471. data/spec/tags/2.1.0/core/array/union_spec.rb +0 -1
  472. data/spec/tags/2.1.0/core/hash/slice_spec.rb +0 -1
  473. data/spec/tags/2.1.0/core/hash/to_h_spec.rb +0 -1
  474. data/spec/tags/2.1.0/core/module/attr_accessor_spec.rb +0 -1
  475. data/spec/tags/2.1.0/core/module/attr_reader_spec.rb +0 -1
  476. data/spec/tags/2.1.0/core/module/attr_spec.rb +0 -1
  477. data/spec/tags/2.1.0/core/module/attr_writer_spec.rb +0 -1
  478. data/spec/tags/2.1.0/core/module/define_method_spec.rb +0 -4
  479. data/spec/tags/2.1.0/core/string/uplus_spec.rb +0 -1
  480. data/spec/tags/2.1.0/core/struct/new_spec.rb +0 -1
  481. data/spec/tags/2.2.0/core/hash/slice_spec.rb +0 -1
  482. data/spec/tags/2.2.0/core/hash/to_h_spec.rb +0 -1
  483. data/spec/tags/2.2.0/core/module/attr_accessor_spec.rb +0 -1
  484. data/spec/tags/2.2.0/core/module/attr_reader_spec.rb +0 -1
  485. data/spec/tags/2.2.0/core/module/attr_spec.rb +0 -1
  486. data/spec/tags/2.2.0/core/module/attr_writer_spec.rb +0 -1
  487. data/spec/tags/2.2.0/core/module/define_method_spec.rb +0 -4
  488. data/spec/tags/2.2.0/core/string/uplus_spec.rb +0 -1
  489. data/spec/tags/2.2.0/core/struct/new_spec.rb +0 -1
  490. data/spec/tags/2.3.0/core/hash/slice_spec.rb +0 -1
  491. data/spec/tags/2.3.0/core/hash/to_h_spec.rb +0 -1
  492. data/spec/tags/2.3.0/core/module/attr_spec.rb +0 -1
  493. data/spec/tags/2.3.0/core/string/uplus_spec.rb +0 -1
  494. data/spec/tags/2.3.0/core/struct/new_spec.rb +0 -1
  495. data/spec/tags/2.4.0/core/hash/slice_spec.rb +0 -1
  496. data/spec/tags/2.4.0/core/hash/to_h_spec.rb +0 -1
  497. data/spec/tags/2.4.0/core/module/attr_spec.rb +0 -1
  498. data/spec/tags/2.4.0/core/struct/new_spec.rb +0 -1
  499. data/spec/tags/2.5.0/core/hash/to_h_spec.rb +0 -1
  500. data/test/README +0 -2
  501. data/test/_backport_guards_test.rb +0 -148
  502. data/test/bit_length_test.rb +0 -11
  503. data/test/lazy_test.rb +0 -487
  504. data/test/socket_interaction_test.rb +0 -9
  505. data/test/test_helper.rb +0 -1
data/backports.gemspec CHANGED
@@ -13,13 +13,17 @@ Gem::Specification.new do |gem|
13
13
  gem.homepage = "http://github.com/marcandre/backports"
14
14
  gem.license = "MIT"
15
15
 
16
- gem.files = `git ls-files`.split($/)
16
+ gem.files = Dir[*%w[
17
+ lib/**/*
18
+ *.{md,txt,gemspec}
19
+ Gemfile
20
+ ]]
17
21
  gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
18
22
  gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
19
23
  gem.require_paths = ["lib"]
20
24
 
21
25
  if gem.respond_to?(:metadata)
22
- gem.metadata['changelog_uri'] = 'https://github.com/marcandre/backports/blob/master/CHANGELOG.rdoc'
26
+ gem.metadata['changelog_uri'] = 'https://github.com/marcandre/backports/blob/master/CHANGELOG.md'
23
27
  gem.metadata['source_code_uri'] = 'https://github.com/marcandre/backports'
24
28
  gem.metadata['bug_tracker_uri'] = 'https://github.com/marcandre/backports/issues'
25
29
  end
@@ -1,4 +1,12 @@
1
1
  # require this file to load all the backports of Ruby 1.8.7
2
2
  require "backports/tools/require_relative_dir"
3
- require "backports/std_lib"
4
- Backports.require_relative_dir
3
+ require "backports/tools/deprecation"
4
+
5
+ Backports.frown_upon :require_version,
6
+ 'Requiring backports/<ruby version> is not recommended in production. Require just the needed backports instead.'
7
+
8
+ if RUBY_VERSION < '1.8.7'
9
+ Backports.warned[:require_std_lib] = true
10
+ require "backports/std_lib"
11
+ Backports.require_relative_dir
12
+ end
@@ -1,3 +1,8 @@
1
1
  # require this file to load all the backports up to Ruby 1.9.1 (including all of 1.8.8 and below)
2
2
  require 'backports/1.8'
3
- Backports.require_relative_dir
3
+
4
+ if RUBY_VERSION < '1.9.1'
5
+ Backports.warned[:require_std_lib] = true
6
+ require "backports/std_lib"
7
+ Backports.require_relative_dir
8
+ end
@@ -11,7 +11,10 @@
11
11
  # Original Documentation:: Gavin Sinclair (sourced from <i>Ruby in a Nutshell</i> (Matsumoto, O'Reilly))
12
12
  ##
13
13
 
14
+ begin
14
15
  require "e2mmap.rb"
16
+ rescue LoadError
17
+ else
15
18
 
16
19
  module ExceptionForMatrix # :nodoc:
17
20
  def_e2message(TypeError, "wrong argument type %s (expected %s)")
@@ -1870,3 +1873,5 @@ class Vector
1870
1873
  end
1871
1874
  end
1872
1875
  end
1876
+
1877
+ end
@@ -1,3 +1,8 @@
1
1
  # require this file to load all the backports up to Ruby 1.9.2
2
2
  require 'backports/1.9.1'
3
- Backports.require_relative_dir
3
+
4
+ if RUBY_VERSION < '1.9.2'
5
+ Backports.warned[:require_std_lib] = true
6
+ require "backports/std_lib"
7
+ Backports.require_relative_dir
8
+ end
@@ -1,3 +1,8 @@
1
1
  # require this file to load all the backports up to Ruby 1.9.3
2
2
  require 'backports/1.9.2'
3
- Backports.require_relative_dir
3
+
4
+ if RUBY_VERSION < '1.9.3'
5
+ Backports.warned[:require_std_lib] = true
6
+ require "backports/std_lib"
7
+ Backports.require_relative_dir
8
+ end
@@ -1,4 +1,6 @@
1
1
  unless Range.method_defined? :size
2
+ require 'backports/1.9.2/float/infinity'
3
+
2
4
  class Range
3
5
  def size
4
6
  return nil unless self.begin.is_a?(Numeric) && self.end.is_a?(Numeric)
@@ -1,3 +1,8 @@
1
1
  # require this file to load all the backports up to Ruby 2.0.0
2
- require 'backports/1.9'
3
- Backports.require_relative_dir
2
+ require 'backports/1.9.3'
3
+
4
+ if RUBY_VERSION < '2.0'
5
+ Backports.warned[:require_std_lib] = true
6
+ require "backports/std_lib"
7
+ Backports.require_relative_dir
8
+ end
@@ -0,0 +1,8 @@
1
+ if Module.method_defined? :singleton_class?
2
+ class Module
3
+ def singleton_class?
4
+ # Hacky...
5
+ inspect.start_with? '#<Class:#'
6
+ end
7
+ end
8
+ end
@@ -1,3 +1,3 @@
1
1
  # require this file to load all the backports up to Ruby 2.1.0
2
- require 'backports/2.0'
3
- Backports.require_relative_dir
2
+ require 'backports/2.0.0'
3
+ Backports.require_relative_dir if RUBY_VERSION < '2.1'
@@ -7,7 +7,7 @@ unless Enumerable.method_defined? :slice_after
7
7
  raise ArgumentError, 'both pattern and block are given' if pattern != Backports::Undefined && block
8
8
  raise ArgumentError, 'wrong number of arguments (given 0, expected 1)' if pattern == Backports::Undefined && !block
9
9
  enum = self
10
- block ||= Proc.new{|elem| pattern === elem}
10
+ block ||= proc {|elem| pattern === elem}
11
11
  Enumerator.new do |y|
12
12
  acc = []
13
13
  enum.each do |*elem|
@@ -4,7 +4,7 @@ unless Float.method_defined? :next_float
4
4
  class Float
5
5
  def next_float
6
6
  return Float::INFINITY if self == Float::INFINITY
7
- r = Backports.integer_to_float(Backports.float_to_integer(self)+1)
7
+ r = Backports.integer_to_float(Backports.float_to_integer(self) + 1)
8
8
  r == 0 ? -0.0 : r # Map +0.0 to -0.0
9
9
  end
10
10
  end
@@ -5,7 +5,7 @@ unless Float.method_defined? :prev_float
5
5
  class Float
6
6
  def prev_float
7
7
  return -Float::INFINITY if self == -Float::INFINITY
8
- Backports.integer_to_float(Backports.float_to_integer(self)-1)
8
+ Backports.integer_to_float(Backports.float_to_integer(self) - 1)
9
9
  end
10
10
  end
11
11
  end
@@ -6,10 +6,10 @@ unless Method.method_defined? :super_method
6
6
  singleton_klass = class << receiver; self; end
7
7
  call_chain = singleton_klass.ancestors
8
8
  # find current position in call chain:
9
- skip = call_chain.find_index{|c| c == owner} or return
9
+ skip = call_chain.find_index {|c| c == owner} or return
10
10
  call_chain = call_chain.drop(skip + 1)
11
11
  # find next in chain with a definition:
12
- next_index = call_chain.find_index{|c| c.method_defined? name}
12
+ next_index = call_chain.find_index {|c| c.method_defined? name}
13
13
  next_index && call_chain[next_index].instance_method(name).bind(receiver)
14
14
  end
15
15
  end
@@ -4,7 +4,7 @@ unless String.method_defined? :unicode_normalize
4
4
  if (Regexp.compile("[\u{11100}-\u{11102}]") rescue false)
5
5
  class String
6
6
  def unicode_normalize(form = :nfc)
7
- require 'backports/tools/normalize.rb' unless defined? UnicodeNormalize
7
+ require 'backports/tools/normalize' unless defined? UnicodeNormalize
8
8
  ## The following line can be uncommented to avoid repeated checking for
9
9
  ## UnicodeNormalize. However, tests didn't show any noticeable speedup
10
10
  ## when doing this. This comment also applies to the commented out lines
@@ -14,13 +14,13 @@ unless String.method_defined? :unicode_normalize
14
14
  end
15
15
 
16
16
  def unicode_normalize!(form = :nfc)
17
- require 'backports/tools/normalize.rb' unless defined? UnicodeNormalize
17
+ require 'backports/tools/normalize' unless defined? UnicodeNormalize
18
18
  # String.send(:define_method, :unicode_normalize!, ->(form = :nfc) { replace(unicode_normalize(form)) } )
19
19
  replace(unicode_normalize(form))
20
20
  end
21
21
 
22
22
  def unicode_normalized?(form = :nfc)
23
- require 'backports/tools/normalize.rb' unless defined? UnicodeNormalize
23
+ require 'backports/tools/normalize' unless defined? UnicodeNormalize
24
24
  # String.send(:define_method, :unicode_normalized?, ->(form = :nfc) { UnicodeNormalize.normalized?(self, form) } )
25
25
  UnicodeNormalize.normalized?(self, form)
26
26
  end
@@ -1,3 +1,3 @@
1
1
  # require this file to load all the backports up to Ruby 2.2
2
- require 'backports/2.1'
3
- Backports.require_relative_dir
2
+ require 'backports/2.1.0'
3
+ Backports.require_relative_dir if RUBY_VERSION < '2.2'
@@ -5,7 +5,7 @@ unless Array.method_defined? :bsearch_index
5
5
  from = 0
6
6
  to = size - 1
7
7
  satisfied = nil
8
- while from <= to do
8
+ while from <= to
9
9
  midpoint = (from + to).div(2)
10
10
  result = yield(self[midpoint])
11
11
  case result
@@ -5,7 +5,7 @@ unless Hash.method_defined? :<
5
5
  hash = Backports.coerce_to_hash(hash)
6
6
  return false unless size < hash.size
7
7
  each do |k, v|
8
- v2 = hash.fetch(k){ return false }
8
+ v2 = hash.fetch(k) { return false }
9
9
  return false unless v2 == v
10
10
  end
11
11
  true
@@ -5,7 +5,7 @@ unless Hash.method_defined? :<=
5
5
  hash = Backports.coerce_to_hash(hash)
6
6
  return false unless size <= hash.size
7
7
  each do |k, v|
8
- v2 = hash.fetch(k){ return false }
8
+ v2 = hash.fetch(k) { return false }
9
9
  return false unless v2 == v
10
10
  end
11
11
  true
@@ -2,7 +2,7 @@ unless Hash.method_defined? :to_proc
2
2
  class Hash
3
3
  def to_proc
4
4
  h = self
5
- Proc.new{|*args| h[*args]}
5
+ proc {|*args| h[*args]}
6
6
  end
7
7
  end
8
8
  end
@@ -0,0 +1,48 @@
1
+ unless Queue.method_defined? :close
2
+ require 'backports/tools/alias_method_chain'
3
+
4
+ class ClosedQueueError < StopIteration
5
+ end
6
+
7
+ class Queue
8
+ CLOSE_MESSAGE = Object.new
9
+
10
+ def push_with_close(arg)
11
+ raise ClosedQueueError, 'queue closed' if closed?
12
+
13
+ push_without_close(arg)
14
+ end
15
+ Backports.alias_method_chain self, :push, :close
16
+ alias_method :<<, :push
17
+ alias_method :enq, :push
18
+
19
+ def pop_with_close(non_block = false)
20
+ begin
21
+ r = pop_without_close(non_block || closed?)
22
+
23
+ r unless CLOSE_MESSAGE == r
24
+ rescue ThreadError
25
+ raise if non_block || !closed?
26
+ end
27
+ end
28
+ Backports.alias_method_chain self, :pop, :close
29
+
30
+ alias_method :shift, :pop
31
+ alias_method :deq, :pop
32
+
33
+ def close
34
+ @closed = true
35
+ 2.times do
36
+ Thread.pass
37
+ num_waiting.times do
38
+ push_without_close CLOSE_MESSAGE
39
+ end
40
+ end
41
+ self
42
+ end
43
+
44
+ def closed?
45
+ !!defined?(@closed)
46
+ end
47
+ end
48
+ end
@@ -0,0 +1,3 @@
1
+ require 'backports/tools/require_relative_dir'
2
+
3
+ Backports.require_relative_dir
@@ -1,12 +1,13 @@
1
1
  unless Struct.method_defined? :dig
2
2
  class Struct
3
3
  def dig(key, *rest)
4
+ return self[key] if key.respond_to?(:to_int)
5
+
4
6
  return nil unless respond_to?(key)
5
- val = self.public_send(key)
7
+ val = public_send(key)
6
8
  return val if rest.empty? || val == nil
7
9
  raise TypeError, "#{val.class} does not have #dig method" unless val.respond_to? :dig
8
10
  val.dig(*rest)
9
11
  end
10
12
  end
11
13
  end
12
-
@@ -1,3 +1,3 @@
1
1
  # require this file to load all the backports up to Ruby 2.3
2
- require 'backports/2.2'
3
- Backports.require_relative_dir
2
+ require 'backports/2.2.0'
3
+ Backports.require_relative_dir if RUBY_VERSION < '2.3'
@@ -0,0 +1,5 @@
1
+ class Bignum
2
+ def dup
3
+ self
4
+ end
5
+ end unless ((1 << 64).dup rescue false)
@@ -0,0 +1,3 @@
1
+ require 'backports/tools/require_relative_dir'
2
+
3
+ Backports.require_relative_dir
@@ -1,6 +1,10 @@
1
1
  module Enumerable
2
- def sum(accumulator = 0, &block)
3
- values = block_given? ? map(&block) : self
4
- values.inject(accumulator, :+)
5
- end unless method_defined? :sum
2
+ unless method_defined? :sum
3
+ require 'backports/1.8.7/enumerable/inject'
4
+
5
+ def sum(accumulator = 0, &block)
6
+ values = block_given? ? map(&block) : self
7
+ values.inject(accumulator, :+)
8
+ end
9
+ end
6
10
  end
@@ -1,6 +1,6 @@
1
1
  class Hash
2
2
  def transform_values
3
- return to_enum(:transform_values){ size } unless block_given?
3
+ return to_enum(:transform_values) { size } unless block_given?
4
4
  h = {}
5
5
  each do |key, value|
6
6
  h[key] = yield value
@@ -9,7 +9,7 @@ class Hash
9
9
  end unless method_defined? :transform_values
10
10
 
11
11
  def transform_values!
12
- return to_enum(:transform_values!){ size } unless block_given?
12
+ return to_enum(:transform_values!) { size } unless block_given?
13
13
  reject!{} if frozen? # Force error triggerring if frozen, in case of empty array
14
14
  each do |key, value|
15
15
  self[key] = yield value
@@ -0,0 +1,7 @@
1
+ unless String.method_defined? :unpack1
2
+ class String
3
+ def unpack1(fmt)
4
+ unpack(fmt)[0]
5
+ end
6
+ end
7
+ end
@@ -3,4 +3,3 @@ class TrueClass
3
3
  self
4
4
  end
5
5
  end unless (true.dup rescue false)
6
-
@@ -1,3 +1,3 @@
1
1
  # require this file to load all the backports up to Ruby 2.4
2
- require 'backports/2.3'
3
- Backports.require_relative_dir
2
+ require 'backports/2.3.0'
3
+ Backports.require_relative_dir if RUBY_VERSION < '2.4'
@@ -3,4 +3,8 @@ class Dir
3
3
  def self.children(*args)
4
4
  entries(*args) - Backports::EXCLUDED_CHILDREN
5
5
  end
6
+
7
+ def children
8
+ self.class.children(path)
9
+ end
6
10
  end unless Dir.respond_to? :children
@@ -4,4 +4,11 @@ class Dir
4
4
  return to_enum(__method__, *args) unless block_given?
5
5
  foreach(*args) { |f| yield f unless Backports::EXCLUDED_CHILDREN.include? f }
6
6
  end
7
+
8
+ def each_child(&block)
9
+ return to_enum(__method__) unless block_given?
10
+
11
+ Dir.each_child(path, &block)
12
+ self
13
+ end
7
14
  end unless Dir.respond_to? :each_child
@@ -1,6 +1,6 @@
1
1
  class Hash
2
2
  def transform_keys
3
- return to_enum(:transform_keys){ size } unless block_given?
3
+ return to_enum(:transform_keys) { size } unless block_given?
4
4
  h = {}
5
5
  each do |key, value|
6
6
  h[yield key] = value
@@ -10,9 +10,16 @@ class Hash
10
10
 
11
11
  def transform_keys!
12
12
  return enum_for(:transform_keys!) { size } unless block_given?
13
- merge!({}) if frozen?
14
- keys.each do |key|
15
- self[yield(key)] = delete(key)
13
+
14
+ self[:trigger_error] = :immediately if frozen?
15
+
16
+ h = {}
17
+ begin
18
+ each do |key, value|
19
+ h[yield key] = value
20
+ end
21
+ ensure
22
+ replace(h)
16
23
  end
17
24
  self
18
25
  end unless method_defined? :transform_keys!
@@ -6,9 +6,9 @@ class Integer
6
6
  def self.sqrt(n)
7
7
  n = Backports.coerce_to_int(n)
8
8
  return Math.sqrt(n).to_i if n <= 9_999_899_999_899_999_322_536_673_279
9
- bits_shift = n.bit_length/2 + 1
9
+ bits_shift = n.bit_length / 2 + 1
10
10
  bitn_mask = root = 1 << bits_shift
11
- while true
11
+ loop do
12
12
  root ^= bitn_mask if (root * root) > n
13
13
  bitn_mask >>= 1
14
14
  return root if bitn_mask == 0
@@ -1,4 +1,3 @@
1
1
  class Module
2
2
  public :alias_method
3
3
  end
4
-
@@ -6,14 +6,10 @@ unless String.method_defined? :undump
6
6
  raise 'string contains null byte' if string["\0"]
7
7
  raise 'non-ASCII character detected' unless string.ascii_only?
8
8
 
9
- #raise '.force_encoding("...") format is not supported by backports' if string.match(/\A".*"\.force_encoding\("[^"]*"\)\z/)
10
- match = string.match(/\A(".*?"?)(?:\.force_encoding\("([^"]*)"\))?\z/)
11
- if match
12
- string = match[1]
13
- encoding = match[2]
14
- else
9
+ match = string.match(/\A(".*?"?)(?:\.force_encoding\("([^"]*)"\))?\z/) or
15
10
  raise %(invalid dumped string; not wrapped with '"' nor '"...".force_encoding("...")' form)
16
- end
11
+ string = match[1]
12
+ encoding = match[2]
17
13
 
18
14
  # Ruby 1.9.3 does weird things to encoding during gsub
19
15
  encoding ||= string.encoding.to_s
@@ -43,9 +39,9 @@ unless String.method_defined? :undump
43
39
  # * only allowing the first character after the \\ to not be alpha/num/space, so \\\\#@inst_var_access is ignored
44
40
  # To reduce the number of calls to eval a little, we wrap everything in a (...)+ so that consecutive escapes are
45
41
  # handled at the same time.
46
- result = string.gsub(/(\\+(u\{[\w ]+\}|[^cCM][\w]*))+/) do |s|
42
+ result = string.gsub(/(\\+(u\{[\w ]+\}|[^cCM]\w*))+/) do |s|
47
43
  begin
48
- eval("\"#{s}\"")
44
+ eval("\"#{s}\"") # "body"
49
45
  rescue SyntaxError => e
50
46
  raise RuntimeError, e.message, e.backtrace
51
47
  end
@@ -19,5 +19,5 @@ if RUBY_VERSION >= '2.0.0' && (Struct.new(:a, :keyword_init => true) && false re
19
19
  end
20
20
  Backports.alias_method_chain(self, :new, :keyword_init)
21
21
  end
22
- ]
22
+ ], nil, __FILE__, __LINE__ - 19
23
23
  end
@@ -1,3 +1,3 @@
1
1
  # require this file to load all the backports up to Ruby 2.5
2
- require 'backports/2.4'
3
- Backports.require_relative_dir
2
+ require 'backports/2.4.0'
3
+ Backports.require_relative_dir if RUBY_VERSION < '2.5'
data/lib/backports/2.5.rb CHANGED
@@ -1,2 +1,2 @@
1
- # require this file to load all the backports of Ruby 2.4 and below
1
+ # require this file to load all the backports of Ruby 2.5 and below
2
2
  require 'backports/2.5.0'
@@ -1,5 +1,9 @@
1
1
  class Array
2
- def difference(*arrays)
3
- arrays.inject(Array.new(self), :-)
4
- end unless method_defined? :difference
2
+ unless method_defined? :difference
3
+ require 'backports/1.8.7/enumerable/inject'
4
+
5
+ def difference(*arrays)
6
+ arrays.inject(Array.new(self), :-)
7
+ end
8
+ end
5
9
  end
@@ -8,11 +8,16 @@ unless Enumerable.method_defined? :chain
8
8
  Enumerator = Enumerable::Enumerator unless Object.const_defined? :Enumerator # For 1.8.x
9
9
 
10
10
  class Enumerator::Chain < Enumerator
11
+ # rubocop:disable Lint/MissingSuper
11
12
  def initialize(*enums)
12
13
  @enums = enums
13
14
  @rewindable = -1
14
- self
15
+ # This self is necessary to pass RubySpec,
16
+ # See rubyspec/core/enumerator/chain/initialize_spec.rb
17
+ # ...it checks what call of #initialize on non-initalized object returns
18
+ self # rubocop:disable Lint/Void
15
19
  end
20
+ # rubocop:enable Lint/MissingSuper
16
21
 
17
22
  def each(*args, &block)
18
23
  @enums.each_with_index do |enum, i|
@@ -1,6 +1,6 @@
1
1
  require 'backports/2.0.0/hash/to_h' unless Hash.method_defined? :to_h
2
2
 
3
- if {:n => true}.to_h{[:ok, true]}[:n]
3
+ if {:n => true}.to_h {[:ok, true]}[:n]
4
4
  require 'backports/tools/alias_method_chain'
5
5
  require 'backports/2.1.0/array/to_h'
6
6
 
@@ -0,0 +1,22 @@
1
+ unless (1..4).cover?(2..3)
2
+ require 'backports/tools/alias_method_chain'
3
+
4
+ class Range
5
+ def cover_with_range_compatibility?(what)
6
+ return cover_without_range_compatibility?(what) unless what.is_a?(Range)
7
+
8
+ left = self.begin <=> what.begin
9
+ right = self.end <=> what.end
10
+ return false unless left && right
11
+
12
+ left <= 0 && (
13
+ right >= 1 ||
14
+ right == 0 && (!exclude_end? || what.exclude_end?) ||
15
+ what.exclude_end? && what.begin.is_a?(Integer) &&
16
+ what.end.is_a?(Integer) && cover_without_range_compatibility?(what.end - 1)
17
+ )
18
+ end
19
+ Backports.alias_method_chain self, :cover?, :range_compatibility
20
+ end
21
+
22
+ end
@@ -0,0 +1,3 @@
1
+ require 'backports/tools/require_relative_dir'
2
+
3
+ Backports.require_relative_dir
@@ -1,3 +1,3 @@
1
- # require this file to load all the backports up to Ruby 2.5
2
- require 'backports/2.5'
3
- Backports.require_relative_dir
1
+ # require this file to load all the backports up to Ruby 2.6
2
+ require 'backports/2.5.0'
3
+ Backports.require_relative_dir if RUBY_VERSION < '2.6'
data/lib/backports/2.6.rb CHANGED
@@ -1,2 +1,2 @@
1
- # require this file to load all the backports of Ruby 2.4 and below
1
+ # require this file to load all the backports of Ruby 2.6 and below
2
2
  require 'backports/2.6.0'
@@ -0,0 +1,7 @@
1
+ require 'backports/1.8.7/enumerable/inject' unless Enumerable.method_defined? :inject
2
+
3
+ class Array
4
+ def intersection(*arrays)
5
+ arrays.inject(Array.new(self), :&)
6
+ end unless method_defined? :intersection
7
+ end
@@ -0,0 +1,3 @@
1
+ require 'backports/tools/require_relative_dir'
2
+
3
+ Backports.require_relative_dir
@@ -0,0 +1,23 @@
1
+ require 'backports/2.4.0/comparable/clamp' unless Comparable.method_defined? :clamp
2
+
3
+ if Comparable.instance_method(:clamp).arity == 2
4
+ require 'backports/tools/alias_method_chain'
5
+ require 'backports/tools/arguments'
6
+
7
+ module Comparable
8
+ def clamp_with_range(range_or_min, max = Backports::Undefined)
9
+ return clamp_without_range(range_or_min, max) unless max == Backports::Undefined
10
+ raise TypeError, "wrong argument type #{range_or_min.class} (expected Range)" unless range_or_min.is_a?(Range)
11
+
12
+ if range_or_min.end.nil? # 2.6's endless range
13
+ self < range_or_min.begin ? range_or_min.begin : self
14
+ elsif range_or_min.exclude_end?
15
+ raise ArgumentError, 'cannot clamp with an exclusive range'
16
+ else
17
+ clamp_without_range(range_or_min.begin, range_or_min.end)
18
+ end
19
+ end
20
+
21
+ Backports.alias_method_chain self, :clamp, :range
22
+ end
23
+ end
@@ -0,0 +1,3 @@
1
+ require 'backports/tools/require_relative_dir'
2
+
3
+ Backports.require_relative_dir