backports 3.10.3 → 3.11.0

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