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
@@ -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
@@ -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: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
@@ -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:Struct.new raises a TypeError if object doesn't respond to to_sym
@@ -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
@@ -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: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
@@ -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:NilClass#dup raises a TypeError
@@ -0,0 +1 @@
1
+ fails:Struct.new raises a TypeError if object doesn't respond to to_sym
@@ -0,0 +1,3 @@
1
+ # require this file to load all the backports up to Ruby 2.5
2
+ require 'backports/2.4'
3
+ Backports.require_relative_dir
@@ -0,0 +1,3 @@
1
+ require 'backports/tools/require_relative_dir'
2
+
3
+ Backports.require_relative_dir
@@ -0,0 +1,3 @@
1
+ class Array
2
+ alias_method :append, :push unless [].respond_to?(:append)
3
+ end
@@ -0,0 +1,3 @@
1
+ class Array
2
+ alias_method :prepend, :unshift unless [].respond_to?(:prepend)
3
+ end
@@ -0,0 +1,3 @@
1
+ require 'backports/tools/require_relative_dir'
2
+
3
+ Backports.require_relative_dir
@@ -0,0 +1,6 @@
1
+ class Dir
2
+ Backports::EXCLUDED_CHILDREN = ['.', '..'].freeze
3
+ def self.children(*args)
4
+ entries(*args) - Backports::EXCLUDED_CHILDREN
5
+ end
6
+ end unless Dir.respond_to? :children
@@ -0,0 +1,7 @@
1
+ class Dir
2
+ Backports::EXCLUDED_CHILDREN = ['.', '..'].freeze
3
+ def self.each_child(*args)
4
+ return to_enum(__method__, *args) unless block_given?
5
+ foreach(*args) { |f| yield f unless Backports::EXCLUDED_CHILDREN.include? f }
6
+ end
7
+ end unless Dir.respond_to? :each_child
@@ -0,0 +1,3 @@
1
+ require 'backports/tools/require_relative_dir'
2
+
3
+ Backports.require_relative_dir
@@ -0,0 +1,13 @@
1
+ if Enumerable.instance_method(:all?).arity == 0
2
+ require 'backports/tools/alias_method_chain'
3
+ require 'backports/tools/arguments'
4
+
5
+ module Enumerable
6
+ def all_with_pattern?(pattern = Backports::Undefined, &block)
7
+ return all_without_pattern?(&block) if Backports::Undefined == pattern
8
+ each_entry { |x| return false unless pattern === x }
9
+ true
10
+ end
11
+ Backports.alias_method_chain(self, :all?, :pattern)
12
+ end
13
+ end
@@ -0,0 +1,42 @@
1
+ if Enumerable.instance_method(:any?).arity == 0
2
+ require 'backports/tools/alias_method_chain'
3
+ require 'backports/tools/arguments'
4
+
5
+ module Enumerable
6
+ def any_with_pattern?(pattern = Backports::Undefined, &block)
7
+ return any_without_pattern?(&block) if Backports::Undefined == pattern
8
+ each_entry { |x| return true if pattern === x }
9
+ false
10
+ end
11
+ Backports.alias_method_chain(self, :any?, :pattern)
12
+ end
13
+ end
14
+
15
+ # MRI specializes `any?` for Array and Hash, so redefine those too
16
+ if Array.instance_method(:any?).arity == 0
17
+ require 'backports/tools/alias_method_chain'
18
+ require 'backports/tools/arguments'
19
+
20
+ class Array
21
+ def any_with_pattern?(pattern = Backports::Undefined, &block)
22
+ return any_without_pattern?(&block) if Backports::Undefined == pattern
23
+ each_entry { |x| return true if pattern === x }
24
+ false
25
+ end
26
+ Backports.alias_method_chain(self, :any?, :pattern)
27
+ end
28
+ end
29
+
30
+ if Hash.instance_method(:any?).arity == 0
31
+ require 'backports/tools/alias_method_chain'
32
+ require 'backports/tools/arguments'
33
+
34
+ class Hash
35
+ def any_with_pattern?(pattern = Backports::Undefined, &block)
36
+ return any_without_pattern?(&block) if Backports::Undefined == pattern
37
+ each_entry { |x| return true if pattern === x }
38
+ false
39
+ end
40
+ Backports.alias_method_chain(self, :any?, :pattern)
41
+ end
42
+ end
@@ -0,0 +1,15 @@
1
+ require 'backports/1.8.7/enumerable/none'
2
+
3
+ if Enumerable.instance_method(:none?).arity == 0
4
+ require 'backports/tools/alias_method_chain'
5
+ require 'backports/tools/arguments'
6
+
7
+ module Enumerable
8
+ def none_with_pattern?(pattern = Backports::Undefined, &block)
9
+ return none_without_pattern?(&block) if Backports::Undefined == pattern
10
+ each_entry { |x| return false if pattern === x }
11
+ true
12
+ end
13
+ Backports.alias_method_chain(self, :none?, :pattern)
14
+ end
15
+ end
@@ -0,0 +1,21 @@
1
+ require 'backports/1.8.7/enumerable/one'
2
+
3
+ if Enumerable.instance_method(:one?).arity == 0
4
+ require 'backports/tools/alias_method_chain'
5
+ require 'backports/tools/arguments'
6
+
7
+ module Enumerable
8
+ def one_with_pattern?(pattern = Backports::Undefined, &block)
9
+ return one_without_pattern?(&block) if Backports::Undefined == pattern
10
+ found_one = false
11
+ each_entry do |o|
12
+ if pattern === o
13
+ return false if found_one
14
+ found_one = true
15
+ end
16
+ end
17
+ found_one
18
+ end
19
+ Backports.alias_method_chain(self, :one?, :pattern)
20
+ end
21
+ end
@@ -0,0 +1,3 @@
1
+ require 'backports/tools/require_relative_dir'
2
+
3
+ Backports.require_relative_dir
@@ -0,0 +1,7 @@
1
+ class Hash
2
+ def slice(*keys)
3
+ h = {}
4
+ keys.each { |k| h[k] = self[k] if key?(k) }
5
+ h
6
+ end unless method_defined?(:slice)
7
+ end
@@ -0,0 +1,19 @@
1
+ class Hash
2
+ def transform_keys
3
+ return to_enum(:transform_keys){ size } unless block_given?
4
+ h = {}
5
+ each do |key, value|
6
+ h[yield key] = value
7
+ end
8
+ h
9
+ end unless method_defined? :transform_keys
10
+
11
+ def transform_keys!
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)
16
+ end
17
+ self
18
+ end unless method_defined? :transform_keys!
19
+ end
@@ -0,0 +1,3 @@
1
+ require 'backports/tools/require_relative_dir'
2
+
3
+ Backports.require_relative_dir
@@ -0,0 +1,8 @@
1
+ class Integer
2
+ require 'backports/tools/arguments'
3
+
4
+ def allbits?(n)
5
+ n = Backports.coerce_to_int(n)
6
+ n & self == n
7
+ end
8
+ end unless Integer.method_defined? :allbits?
@@ -0,0 +1,8 @@
1
+ class Integer
2
+ require 'backports/tools/arguments'
3
+
4
+ def anybits?(n)
5
+ n = Backports.coerce_to_int(n)
6
+ n & self != 0
7
+ end
8
+ end unless Integer.method_defined? :anybits?
@@ -0,0 +1,8 @@
1
+ class Integer
2
+ require 'backports/tools/arguments'
3
+
4
+ def nobits?(n)
5
+ n = Backports.coerce_to_int(n)
6
+ n & self == 0
7
+ end
8
+ end unless Integer.method_defined? :nobits?
@@ -0,0 +1,18 @@
1
+ class Integer
2
+ require 'backports/tools/arguments'
3
+ require 'backports/2.1.0/bignum/bit_length'
4
+ require 'backports/2.1.0/fixnum/bit_length'
5
+
6
+ def self.sqrt(n)
7
+ n = Backports.coerce_to_int(n)
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
10
+ bitn_mask = root = 1 << bits_shift
11
+ while true
12
+ root ^= bitn_mask if (root * root) > n
13
+ bitn_mask >>= 1
14
+ return root if bitn_mask == 0
15
+ root |= bitn_mask
16
+ end
17
+ end
18
+ end unless Integer.respond_to? :sqrt
@@ -0,0 +1,3 @@
1
+ require 'backports/tools/require_relative_dir'
2
+
3
+ Backports.require_relative_dir
@@ -0,0 +1,6 @@
1
+ module Kernel
2
+ def yield_self
3
+ return to_enum(__method__) { 1 } unless block_given?
4
+ yield self
5
+ end unless method_defined? :yield_self
6
+ end
@@ -0,0 +1,3 @@
1
+ require 'backports/tools/require_relative_dir'
2
+
3
+ Backports.require_relative_dir
@@ -0,0 +1,4 @@
1
+ class Module
2
+ public :alias_method
3
+ end
4
+
@@ -0,0 +1,3 @@
1
+ class Module
2
+ public :attr
3
+ end
@@ -0,0 +1,3 @@
1
+ class Module
2
+ public :attr_accessor
3
+ end
@@ -0,0 +1,3 @@
1
+ class Module
2
+ public :attr_reader
3
+ end
@@ -0,0 +1,3 @@
1
+ class Module
2
+ public :attr_writer
3
+ end
@@ -0,0 +1,3 @@
1
+ class Module
2
+ public :define_method
3
+ end
@@ -0,0 +1,3 @@
1
+ class Module
2
+ public :remove_method
3
+ end
@@ -0,0 +1,3 @@
1
+ class Module
2
+ public :undef_method
3
+ end
@@ -0,0 +1,3 @@
1
+ require 'backports/tools/require_relative_dir'
2
+
3
+ Backports.require_relative_dir