backports 3.18.0 → 3.23.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +435 -292
- data/Gemfile +3 -16
- data/README.md +306 -156
- data/backports.gemspec +1 -1
- data/lib/backports/2.0.0.rb +1 -1
- data/lib/backports/2.1.0/module/singleton_class.rb +8 -0
- data/lib/backports/2.1.0.rb +1 -1
- data/lib/backports/2.2.0/string/unicode_normalize.rb +3 -3
- data/lib/backports/2.2.0.rb +1 -1
- data/lib/backports/2.3.0/queue/close.rb +48 -0
- data/lib/backports/2.3.0/string.rb +3 -0
- data/lib/backports/2.3.0/struct/dig.rb +2 -0
- data/lib/backports/2.3.0.rb +1 -1
- data/lib/backports/2.4.0/bignum/dup.rb +5 -0
- data/lib/backports/2.4.0/bignum.rb +3 -0
- data/lib/backports/2.4.0/string/unpack1.rb +7 -0
- data/lib/backports/2.4.0.rb +1 -1
- data/lib/backports/2.5.0/dir/children.rb +4 -0
- data/lib/backports/2.5.0/dir/each_child.rb +7 -0
- data/lib/backports/2.5.0/hash/transform_keys.rb +10 -3
- data/lib/backports/2.5.0/string/undump.rb +2 -2
- data/lib/backports/2.5.0.rb +1 -1
- data/lib/backports/2.5.rb +1 -1
- data/lib/backports/2.6.0/enumerable/chain.rb +2 -0
- data/lib/backports/2.6.0.rb +2 -2
- data/lib/backports/2.6.rb +1 -1
- data/lib/backports/2.7.0/complex/{comparision.rb → comparison.rb} +0 -0
- data/lib/backports/2.7.0/enumerable/tally.rb +4 -3
- data/lib/backports/2.7.0/symbol/end_with.rb +9 -0
- data/lib/backports/2.7.0/symbol.rb +3 -0
- data/lib/backports/2.7.0.rb +2 -2
- data/lib/backports/3.0.0/env/except.rb +10 -0
- data/lib/backports/3.0.0/env.rb +3 -0
- data/lib/backports/3.0.0/hash/except.rb +10 -0
- data/lib/backports/3.0.0/hash/transform_keys.rb +48 -0
- data/lib/backports/3.0.0/hash.rb +3 -0
- data/lib/backports/3.0.0/ractor.rb +19 -0
- data/lib/backports/3.0.0/symbol/name.rb +21 -0
- data/lib/backports/3.0.0/symbol.rb +3 -0
- data/lib/backports/3.0.0.rb +3 -0
- data/lib/backports/3.0.rb +1 -0
- data/lib/backports/3.1.0/array/intersect.rb +16 -0
- data/lib/backports/3.1.0/array.rb +3 -0
- data/lib/backports/3.1.0/class/descendants.rb +11 -0
- data/lib/backports/3.1.0/class/subclasses.rb +11 -0
- data/lib/backports/3.1.0/class.rb +3 -0
- data/lib/backports/3.1.0/enumerable/compact.rb +5 -0
- data/lib/backports/3.1.0/enumerable/tally.rb +18 -0
- data/lib/backports/3.1.0/enumerable.rb +3 -0
- data/lib/backports/3.1.0/file/dirname.rb +16 -0
- data/lib/backports/3.1.0/file.rb +3 -0
- data/lib/backports/3.1.0/integer/try_convert.rb +7 -0
- data/lib/backports/3.1.0/integer.rb +3 -0
- data/lib/backports/3.1.0/match_data/match.rb +5 -0
- data/lib/backports/3.1.0/match_data/match_length.rb +6 -0
- data/lib/backports/3.1.0/match_data.rb +3 -0
- data/lib/backports/3.1.0/struct/keyword_init.rb +5 -0
- data/lib/backports/3.1.0/struct.rb +3 -0
- data/lib/backports/3.1.0.rb +3 -0
- data/lib/backports/3.1.rb +1 -0
- data/lib/backports/latest.rb +1 -1
- data/lib/backports/ractor/cloner.rb +103 -0
- data/lib/backports/ractor/errors.rb +20 -0
- data/lib/backports/ractor/filtered_queue.rb +205 -0
- data/lib/backports/ractor/queues.rb +66 -0
- data/lib/backports/ractor/ractor.rb +272 -0
- data/lib/backports/ractor/sharing.rb +97 -0
- data/lib/backports/version.rb +1 -1
- metadata +51 -8
data/README.md
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
# Backports Library [<img src="https://travis-ci.org/marcandre/backports.svg?branch=master">](https://travis-ci.org/marcandre/backports) [<img src="https://badge.fury.io/rb/backports.svg" alt="Gem Version" />](http://badge.fury.io/rb/backports) [](https://tidelift.com/subscription/pkg/rubygems-backports?utm_source=rubygems-backports&utm_medium=referral&utm_campaign=readme)
|
2
2
|
|
3
|
-
Yearning to
|
3
|
+
Yearning to write a gem using some new cool features in Ruby 3.1 while
|
4
|
+
still supporting Ruby 2.5.x?
|
4
5
|
Have some legacy code in Ruby 1.8 but can't live without `flat_map`?
|
5
6
|
|
6
7
|
This gem is for you!
|
@@ -9,20 +10,20 @@ The goal of 'backports' is to make it easier to write ruby code that runs
|
|
9
10
|
across different versions of Ruby.
|
10
11
|
|
11
12
|
Note: [Next major version (X-mas
|
12
|
-
|
13
|
+
2021?)](https://github.com/marcandre/backports/issues/139) may drop support
|
13
14
|
for Ruby < 2.2.
|
14
15
|
|
15
16
|
## Loading backports
|
16
17
|
|
17
18
|
### Explicitly (recommended)
|
18
19
|
|
19
|
-
For example, if you want to use transform_values and transform_keys
|
20
|
+
For example, if you want to use `transform_values` and `transform_keys`, even in
|
20
21
|
Ruby implementations that don't include it:
|
21
22
|
|
22
23
|
require 'backports/2.4.0/hash/transform_values'
|
23
24
|
require 'backports/2.5.0/hash/transform_keys'
|
24
25
|
|
25
|
-
This will enable Hash#transform_values and Hash#transform_keys
|
26
|
+
This will enable `Hash#transform_values` and `Hash#transform_keys`, using the
|
26
27
|
native versions if available or otherwise provide a pure Ruby version.
|
27
28
|
|
28
29
|
### By Module
|
@@ -32,32 +33,31 @@ Class:
|
|
32
33
|
|
33
34
|
require 'backports/2.3.0/hash'
|
34
35
|
|
35
|
-
This will make sure that Hash responds to dig
|
36
|
-
to_proc
|
36
|
+
This will make sure that Hash responds to `dig`, `fetch_values`, `to_proc` and comparisons.
|
37
37
|
|
38
38
|
### Up to a specific Ruby version (for quick coding)
|
39
39
|
|
40
40
|
You can load all backports up to a specific version.
|
41
|
-
For example, to bring any
|
42
|
-
version of Ruby mostly up to Ruby 2.7.0's standards:
|
41
|
+
For example, to bring any version of Ruby mostly up to Ruby 3.1.0's standards:
|
43
42
|
|
44
|
-
require 'backports/
|
43
|
+
require 'backports/3.1.0'
|
45
44
|
|
46
45
|
This will bring in all the features of 1.8.7 and many features of Ruby 1.9.x
|
47
|
-
all the way up to Ruby
|
46
|
+
all the way up to Ruby 3.1.0 (for all versions of Ruby)!
|
48
47
|
|
49
48
|
You may `require 'backports/latest'` as a
|
50
49
|
shortcut to the latest Ruby version supported.
|
51
50
|
|
52
|
-
|
51
|
+
_Note_: For production / public gems, it is highly recommended you only require
|
53
52
|
the backports you need explicitly.
|
54
53
|
|
55
|
-
|
54
|
+
_Note_: Although I am a Ruby committer, this gem is a personal project and is
|
56
55
|
not endorsed by ruby-core.
|
57
56
|
|
58
57
|
## What's inside
|
59
58
|
|
60
59
|
Goals for backported features:
|
60
|
+
|
61
61
|
1. Won't break older code
|
62
62
|
2. Pure Ruby (no C extensions)
|
63
63
|
3. Pass [ruby/spec](https://github.com/ruby/spec)
|
@@ -109,328 +109,467 @@ itself, JRuby and Rubinius.
|
|
109
109
|
|
110
110
|
# Complete List of backports
|
111
111
|
|
112
|
+
## Ruby 3.1 backports
|
113
|
+
|
114
|
+
#### Array
|
115
|
+
|
116
|
+
- `intersect?`
|
117
|
+
|
118
|
+
#### Class
|
119
|
+
|
120
|
+
- `descendants`
|
121
|
+
- `subclasses`
|
122
|
+
|
123
|
+
#### Enumerable
|
124
|
+
|
125
|
+
- `compact`
|
126
|
+
- `tally` (with hash argument)
|
127
|
+
|
128
|
+
### File
|
129
|
+
|
130
|
+
- `dirname` (with depth argument)
|
131
|
+
|
132
|
+
#### Integer
|
133
|
+
|
134
|
+
- `try_convert`
|
135
|
+
|
136
|
+
#### MatchData
|
137
|
+
|
138
|
+
- `match`
|
139
|
+
- `match_length`
|
140
|
+
|
141
|
+
#### Struct
|
142
|
+
|
143
|
+
- `keyword_init?`
|
144
|
+
|
145
|
+
## Ruby 3.0 backports
|
146
|
+
|
147
|
+
#### Env
|
148
|
+
|
149
|
+
- `except`
|
150
|
+
|
151
|
+
#### Hash
|
152
|
+
|
153
|
+
- `except`
|
154
|
+
- `transform_keys`, `transform_keys!` (with hash argument)
|
155
|
+
|
156
|
+
#### Ractor
|
157
|
+
|
158
|
+
- All methods, with the caveats:
|
159
|
+
- uses Ruby's `Thread` internally
|
160
|
+
- will not raise some errors when `Ractor` would (in particular `Ractor::IsolationError`)
|
161
|
+
- supported in Ruby 2.0+ only
|
162
|
+
|
163
|
+
#### Symbol
|
164
|
+
|
165
|
+
- `name`
|
166
|
+
|
112
167
|
## Ruby 2.7 backports
|
113
168
|
|
114
169
|
#### Array
|
115
|
-
|
170
|
+
|
171
|
+
- `intersection`
|
116
172
|
|
117
173
|
#### Comparable
|
118
|
-
|
174
|
+
|
175
|
+
- `clamp` (with range)
|
119
176
|
|
120
177
|
#### Complex
|
121
|
-
|
178
|
+
|
179
|
+
- `<=>`
|
122
180
|
|
123
181
|
#### Enumerable
|
124
|
-
|
125
|
-
|
182
|
+
|
183
|
+
- `filter_map`
|
184
|
+
- `tally`
|
126
185
|
|
127
186
|
#### Enumerator
|
128
|
-
|
187
|
+
|
188
|
+
- `produce` (class method)
|
189
|
+
|
190
|
+
#### Symbol
|
191
|
+
- `end_with?`
|
129
192
|
|
130
193
|
#### Time
|
131
|
-
|
194
|
+
|
195
|
+
- `floor`, `ceil`
|
132
196
|
|
133
197
|
## Ruby 2.6 backports
|
134
198
|
|
135
199
|
#### Array
|
136
|
-
|
137
|
-
|
200
|
+
|
201
|
+
- `difference`, `union`
|
202
|
+
- `to_h` (with block)
|
138
203
|
|
139
204
|
#### Enumerable
|
140
|
-
|
141
|
-
|
205
|
+
|
206
|
+
- `chain`
|
207
|
+
- `to_h` (with block)
|
142
208
|
|
143
209
|
#### Enumerator::Chain (use Enumerable#chain)
|
144
210
|
|
145
211
|
#### Hash
|
146
|
-
|
147
|
-
|
212
|
+
|
213
|
+
- `merge`, `merge!`/`update` (with multiple arguments)
|
214
|
+
- `to_h` (with block)
|
148
215
|
|
149
216
|
#### Kernel
|
150
|
-
|
217
|
+
|
218
|
+
- `then`
|
151
219
|
|
152
220
|
#### Method
|
153
|
-
|
221
|
+
|
222
|
+
- `<<`, `>>`
|
154
223
|
|
155
224
|
#### Proc
|
156
|
-
|
225
|
+
|
226
|
+
- `<<`, `>>`
|
157
227
|
|
158
228
|
#### Range
|
159
|
-
|
229
|
+
|
230
|
+
- `cover?` (with `Range` argument)
|
160
231
|
|
161
232
|
## Ruby 2.5 backports
|
162
233
|
|
163
234
|
#### Array
|
164
|
-
|
235
|
+
|
236
|
+
- `append`, `prepend`
|
165
237
|
|
166
238
|
#### Dir
|
167
|
-
|
239
|
+
|
240
|
+
- `children`, `each_child`
|
168
241
|
|
169
242
|
#### Enumerable
|
170
|
-
|
243
|
+
|
244
|
+
- `any?`, `all?`, `none?`, `one?` (with pattern argument)
|
171
245
|
|
172
246
|
#### Hash
|
173
|
-
|
174
|
-
|
247
|
+
|
248
|
+
- `slice`
|
249
|
+
- `transform_keys`
|
175
250
|
|
176
251
|
#### Integer
|
177
|
-
|
178
|
-
|
252
|
+
|
253
|
+
- `sqrt`
|
254
|
+
- `allbits?`, `anybits?` and `nobits?`
|
179
255
|
|
180
256
|
#### Kernel
|
181
|
-
|
257
|
+
|
258
|
+
- `yield_self`
|
182
259
|
|
183
260
|
#### Module
|
184
|
-
|
185
|
-
|
186
|
-
|
261
|
+
|
262
|
+
- `attr`, `attr_accessor`, `attr_reader`, `attr_writer` (now public)
|
263
|
+
- `define_method`, `alias_method`, `undef_method`, `remove_method` (now
|
264
|
+
public)
|
187
265
|
|
188
266
|
#### String
|
189
|
-
|
190
|
-
|
191
|
-
|
267
|
+
|
268
|
+
- `delete_prefix`, `delete_prefix!`
|
269
|
+
- `delete_suffix`, `delete_suffix!`
|
270
|
+
- `undump`
|
192
271
|
|
193
272
|
#### Struct
|
194
|
-
|
273
|
+
|
274
|
+
- `new` (with `keyword_init: true`)
|
195
275
|
|
196
276
|
## Ruby 2.4 backports
|
197
277
|
|
198
278
|
#### Comparable
|
199
|
-
|
279
|
+
|
280
|
+
- `clamp`
|
200
281
|
|
201
282
|
#### Enumerable
|
202
|
-
|
203
|
-
|
283
|
+
|
284
|
+
- `sum`
|
285
|
+
- `uniq`
|
204
286
|
|
205
287
|
#### Hash
|
206
|
-
|
207
|
-
|
288
|
+
|
289
|
+
- `compact`, `compact!`
|
290
|
+
- `transform_values`, `transform_values!`
|
291
|
+
|
292
|
+
#### Queue
|
293
|
+
|
294
|
+
- `close`, `closed?`
|
208
295
|
|
209
296
|
#### Regexp
|
210
|
-
|
297
|
+
|
298
|
+
- `match?`
|
211
299
|
|
212
300
|
#### String
|
213
|
-
- `match?`
|
214
301
|
|
215
|
-
|
216
|
-
|
302
|
+
- `match?`
|
303
|
+
- `unpack1`
|
304
|
+
|
305
|
+
#### FalseClass, Fixnum, Bignum, Float, NilClass, TrueClass
|
306
|
+
|
307
|
+
- `dup`
|
217
308
|
|
218
309
|
## Ruby 2.3 backports
|
219
310
|
|
220
311
|
#### Array
|
221
|
-
|
222
|
-
|
312
|
+
|
313
|
+
- `bsearch_index`
|
314
|
+
- `dig`
|
223
315
|
|
224
316
|
#### Enumerable
|
225
|
-
|
226
|
-
|
317
|
+
|
318
|
+
- `chunk_while`
|
319
|
+
- `grep_v`
|
227
320
|
|
228
321
|
#### Hash
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
322
|
+
|
323
|
+
- `dig`
|
324
|
+
- `fetch_values`
|
325
|
+
- `to_proc`
|
326
|
+
- <=, <, >=, >
|
233
327
|
|
234
328
|
#### Numeric
|
235
|
-
|
236
|
-
|
329
|
+
|
330
|
+
- `negative?`
|
331
|
+
- `positive?`
|
237
332
|
|
238
333
|
#### String
|
239
|
-
|
334
|
+
|
335
|
+
- unary + and -
|
240
336
|
|
241
337
|
#### Struct
|
242
|
-
|
338
|
+
|
339
|
+
- `dig`
|
243
340
|
|
244
341
|
## Ruby 2.2 backports
|
245
342
|
|
246
343
|
#### Enumerable
|
247
|
-
|
248
|
-
|
344
|
+
|
345
|
+
- `slice_after`
|
346
|
+
- `slice_when`
|
249
347
|
|
250
348
|
#### Float
|
251
|
-
|
252
|
-
|
349
|
+
|
350
|
+
- `prev_float`
|
351
|
+
- `next_float`
|
253
352
|
|
254
353
|
#### Kernel
|
255
|
-
|
354
|
+
|
355
|
+
- `itself`
|
256
356
|
|
257
357
|
#### Method
|
258
|
-
|
259
|
-
|
358
|
+
|
359
|
+
- `curry`
|
360
|
+
- `super_method`
|
260
361
|
|
261
362
|
#### String
|
262
|
-
|
263
|
-
|
264
|
-
|
363
|
+
|
364
|
+
- `unicode_normalize`
|
365
|
+
- `unicode_normalize!`
|
366
|
+
- `unicode_normalize?`
|
265
367
|
|
266
368
|
## Ruby 2.1 backports
|
267
369
|
|
268
370
|
#### Array
|
269
|
-
|
371
|
+
|
372
|
+
- `to_h`
|
270
373
|
|
271
374
|
#### Bignum
|
272
|
-
|
375
|
+
|
376
|
+
- `bit_length`
|
273
377
|
|
274
378
|
#### Enumerable
|
275
|
-
|
379
|
+
|
380
|
+
- `to_h`
|
276
381
|
|
277
382
|
#### Fixnum
|
278
|
-
|
383
|
+
|
384
|
+
- `bit_length`
|
279
385
|
|
280
386
|
#### Module
|
281
|
-
|
387
|
+
|
388
|
+
- `include` (now public)
|
389
|
+
- `singleton_class?`
|
282
390
|
|
283
391
|
## Ruby 2.0 backports
|
284
392
|
|
285
393
|
#### Array
|
286
|
-
|
394
|
+
|
395
|
+
- `bsearch`
|
287
396
|
|
288
397
|
#### Enumerable
|
289
|
-
|
398
|
+
|
399
|
+
- `lazy`
|
290
400
|
|
291
401
|
#### Enumerator::Lazy
|
292
|
-
|
402
|
+
|
403
|
+
- all methods
|
293
404
|
|
294
405
|
#### Hash
|
295
|
-
|
296
|
-
|
406
|
+
|
407
|
+
- `default_proc=` (with nil argument)
|
408
|
+
- `to_h`
|
297
409
|
|
298
410
|
#### `nil.to_h`
|
299
411
|
|
300
412
|
#### Range
|
301
|
-
|
413
|
+
|
414
|
+
- `bsearch`
|
302
415
|
|
303
416
|
#### Struct
|
304
|
-
|
417
|
+
|
418
|
+
- `to_h`
|
305
419
|
|
306
420
|
## Ruby 1.9.3 backports
|
307
421
|
|
308
422
|
#### File
|
309
|
-
|
423
|
+
|
424
|
+
- `NULL`
|
310
425
|
|
311
426
|
#### IO
|
312
|
-
|
313
|
-
|
427
|
+
|
428
|
+
- `advise` (acts as a noop)
|
429
|
+
- `write`, `binwrite`
|
314
430
|
|
315
431
|
#### String
|
316
|
-
|
317
|
-
|
432
|
+
|
433
|
+
- `byteslice`
|
434
|
+
- `prepend`
|
318
435
|
|
319
436
|
## Ruby 1.9.2 backports
|
320
437
|
|
321
438
|
#### Array
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
439
|
+
|
440
|
+
- `rotate, rotate!`
|
441
|
+
- `keep_if, select!`
|
442
|
+
- `product` (with block)
|
443
|
+
- `repeated_combination`, `repeated_permutation`
|
444
|
+
- `sort_by!`
|
445
|
+
- `uniq, uniq!` (with block)
|
328
446
|
|
329
447
|
#### Complex
|
330
|
-
|
448
|
+
|
449
|
+
- `to_r`
|
331
450
|
|
332
451
|
#### Dir
|
333
|
-
|
452
|
+
|
453
|
+
- `home`
|
334
454
|
|
335
455
|
#### Enumerable
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
|
456
|
+
|
457
|
+
- `chunk`
|
458
|
+
- `flat_map`, `collect_concat`
|
459
|
+
- `join`
|
460
|
+
- `slice_before`
|
340
461
|
|
341
462
|
#### Float::INFINITY, NAN
|
342
463
|
|
343
464
|
#### Hash
|
344
|
-
|
465
|
+
|
466
|
+
- `keep_if`, `select!`
|
345
467
|
|
346
468
|
#### Object
|
347
|
-
|
469
|
+
|
470
|
+
- `singleton_class`
|
348
471
|
|
349
472
|
#### Random (new class)
|
350
473
|
|
351
|
-
|
474
|
+
_Note_: The methods of `Random` can't be required individually; the class
|
352
475
|
can only be required whole with `require 'backports/1.9.2/random'`.
|
353
476
|
|
354
477
|
## Ruby 1.9.1 backports
|
355
478
|
|
356
479
|
Additionally, the following Ruby 1.9 features have been backported:
|
480
|
+
|
357
481
|
#### Array
|
358
|
-
|
359
|
-
|
482
|
+
|
483
|
+
- `try_convert`
|
484
|
+
- `sample`
|
360
485
|
|
361
486
|
#### Enumerable
|
362
|
-
|
363
|
-
|
487
|
+
|
488
|
+
- `each_with_object`
|
489
|
+
- `each_with_index` (with arguments)
|
364
490
|
|
365
491
|
#### Enumerator
|
366
|
-
|
492
|
+
|
493
|
+
- `new` (with block)
|
367
494
|
|
368
495
|
#### File
|
369
|
-
|
370
|
-
|
371
|
-
|
372
|
-
|
373
|
-
|
496
|
+
|
497
|
+
- `binread`
|
498
|
+
- `to_path`
|
499
|
+
- All class methods accepting filenames will accept files or anything
|
500
|
+
with a `#to_path` method.
|
501
|
+
- `File.open` accepts an options hash.
|
374
502
|
|
375
503
|
#### Float
|
376
|
-
|
504
|
+
|
505
|
+
- `round`
|
377
506
|
|
378
507
|
#### Hash
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
|
508
|
+
|
509
|
+
- `assoc`, `rassoc`
|
510
|
+
- `key`
|
511
|
+
- `try_convert`
|
512
|
+
- `default_proc=`
|
383
513
|
|
384
514
|
#### Integer
|
385
|
-
|
386
|
-
|
515
|
+
|
516
|
+
- `magnitude`
|
517
|
+
- `round`
|
387
518
|
|
388
519
|
#### IO
|
389
|
-
|
390
|
-
|
391
|
-
|
392
|
-
|
520
|
+
|
521
|
+
- `bin_read`
|
522
|
+
- `try_convert`
|
523
|
+
- `ungetbyte`
|
524
|
+
- `IO.open` accepts an options hash.
|
393
525
|
|
394
526
|
#### Kernel
|
395
|
-
|
527
|
+
|
528
|
+
- `require_relative`
|
396
529
|
|
397
530
|
#### Math
|
398
|
-
|
399
|
-
|
531
|
+
|
532
|
+
- `log` (with base)
|
533
|
+
- `log2`
|
400
534
|
|
401
535
|
#### Numeric
|
402
|
-
|
536
|
+
|
537
|
+
- `round`
|
403
538
|
|
404
539
|
#### Object
|
405
|
-
|
406
|
-
|
407
|
-
|
540
|
+
|
541
|
+
- `define_singleton_method`
|
542
|
+
- `public_method`
|
543
|
+
- `public_send`
|
408
544
|
|
409
545
|
#### Proc
|
410
|
-
|
411
|
-
|
412
|
-
|
413
|
-
|
546
|
+
|
547
|
+
- `yield`
|
548
|
+
- `lambda?`
|
549
|
+
- `curry`
|
550
|
+
- `===`
|
414
551
|
|
415
552
|
#### Range
|
416
|
-
|
553
|
+
|
554
|
+
- `cover?`
|
417
555
|
|
418
556
|
#### Regexp
|
419
|
-
|
557
|
+
|
558
|
+
- `try_convert`
|
420
559
|
|
421
560
|
#### String
|
422
|
-
|
423
|
-
|
424
|
-
|
425
|
-
|
426
|
-
|
427
|
-
|
428
|
-
|
561
|
+
|
562
|
+
- `ascii_only?`
|
563
|
+
- `chr`
|
564
|
+
- `clear`
|
565
|
+
- `codepoints`, `each_codepoint`
|
566
|
+
- `get_byte`, `set_byte`
|
567
|
+
- `ord`
|
568
|
+
- `try_convert`
|
429
569
|
|
430
570
|
`Enumerator` can be accessed directly (instead of `Enumerable::Enumerator`)
|
431
571
|
|
432
|
-
To include
|
433
|
-
"backports/1.9.1"`.
|
572
|
+
To include _only_ these backports and those of the 1.8 line, `require "backports/1.9.1"`.
|
434
573
|
|
435
574
|
Moreover, a pretty good imitation of `BasicObject` is available, but since it
|
436
575
|
is only an imitation, it must be required explicitly:
|
@@ -444,8 +583,11 @@ Complete Ruby 1.8.7 backporting (core language). Refer to the official list of
|
|
444
583
|
backports!
|
445
584
|
|
446
585
|
Only exceptions:
|
586
|
+
|
447
587
|
#### String#gsub (the form returning an enumerator)
|
448
|
-
|
588
|
+
|
589
|
+
#### GC.stress= (not implemented)
|
590
|
+
|
449
591
|
#### Array#choice (removed in 1.9, use 1.9.1's Array#sample instead)
|
450
592
|
|
451
593
|
## Libraries
|
@@ -457,7 +599,9 @@ The backports would be automatically used after requiring 'backports/std_lib' bu
|
|
457
599
|
The following libraries are up to date with Ruby 1.9.3:
|
458
600
|
|
459
601
|
#### Matrix
|
602
|
+
|
460
603
|
#### Prime
|
604
|
+
|
461
605
|
#### Set
|
462
606
|
|
463
607
|
The following library is to date with Ruby 2.0.0:
|
@@ -468,6 +612,7 @@ I am aware of the following backport gem, which probably won't make it into
|
|
468
612
|
this gem:
|
469
613
|
|
470
614
|
#### Net::SMTP for Ruby 1.8.6:
|
615
|
+
|
471
616
|
[smtp_tls](http://seattlerb.rubyforge.org/smtp_tls/)
|
472
617
|
|
473
618
|
Requiring backports for a given version of Ruby will also load
|
@@ -480,13 +625,16 @@ but could be useful in some projects. It is possible to request such
|
|
480
625
|
incompatible changes. Backports currently supports the following:
|
481
626
|
|
482
627
|
#### Hash
|
483
|
-
|
628
|
+
|
629
|
+
- `select` (returns a Hash instead of an Array)
|
484
630
|
|
485
631
|
#### Enumerable / Array
|
486
|
-
|
632
|
+
|
633
|
+
- `map` (returns an enumerator when called without a block)
|
487
634
|
|
488
635
|
#### String
|
489
|
-
|
636
|
+
|
637
|
+
- `length`, `size` (for UTF-8 support)
|
490
638
|
|
491
639
|
These must be imported in addition to the backports gem, for example:
|
492
640
|
|
@@ -498,8 +646,11 @@ These must be imported in addition to the backports gem, for example:
|
|
498
646
|
Thanks for the bug reports and patches, in particular the repeat offenders:
|
499
647
|
|
500
648
|
#### Arto Bendiken ( [bendiken](http://github.com/bendiken) )
|
649
|
+
|
501
650
|
#### Konstantin Haase ( [rkh](https://github.com/rkh) )
|
651
|
+
|
502
652
|
#### Roger Pack ( [rdp](http://github.com/rdp) )
|
653
|
+
|
503
654
|
#### Victor Shepelev ( [zverok](http://github.com/zverok) )
|
504
655
|
|
505
656
|
## Contributing
|
@@ -525,5 +676,4 @@ Failures that are acceptable are added the to `tags` file.
|
|
525
676
|
LICENSE file.
|
526
677
|
|
527
678
|
Author
|
528
|
-
:
|
529
|
-
|
679
|
+
: Marc-André Lafortune
|