polyfill 1.0.1 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 92227bb8f662fa804daec462ad06677e8c48daaf
4
- data.tar.gz: 2b37e9e8d480fc237f87e4df3843553f003f94f3
2
+ SHA256:
3
+ metadata.gz: b139f1e058fce855365397a2bbe902b2092da2a3a6e64e9326d6d136487a2e31
4
+ data.tar.gz: e58e5b7b5ed9ee95375abfdc9f959730fbb4e900df86f5db11017a4241212a71
5
5
  SHA512:
6
- metadata.gz: 8553939d9ca0cb4e35741e9282b6c47b1fdac36d0da96f4964930a83a7c75f623c79a7f974dad644c98cc1e96a2ea3f95f4011080c655c318eb76c5039217094
7
- data.tar.gz: 9698831784840c272b34f04ddeb83a8e097223a76ac9671b7f66c1f820036b6a1985e14d35de6d16543b81e087f21ee02c2a92246843b5e6bf8602e583b4c72d
6
+ metadata.gz: 314f9d7bdd0385f0fb2682b9f4b1a2a2d30b967ee454a91c77aeeeeef651600a38a42642cc83b01c25197b7ae3e6180cbe91b45e7ebdf37713e9c305cfd0c384
7
+ data.tar.gz: 4bf25f12ca82bb158353cc89994c46f04e0f183ba39e43c063d3195c7b5f486b00182912760daa4f6f5812d6f45ee6d282f03dac6a0cdc7e906aa428d035122a
@@ -1,6 +1,7 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 2.4.1
3
+ - 2.5.0
4
+ - 2.4.2
4
5
  - 2.3.4
5
6
  - 2.2.7
6
7
  - 2.1.10
@@ -1,3 +1,43 @@
1
+ # Master
2
+
3
+ # [1.1.0][] (2018-02-23)
4
+
5
+ ## Added
6
+
7
+ - The verison now uses Gem::Version for easier comparisons
8
+ - v2.5 Integer#allbits?
9
+ - v2.5 Integer#anybits?
10
+ - v2.5 Integer#ceil
11
+ - v2.5 Integer#floor
12
+ - v2.5 Integer#nobits?
13
+ - v2.5 Integer#round
14
+ - v2.5 Integer#truncate
15
+ - v2.5 Hash#slice
16
+ - v2.5 Hash#transform_keys
17
+ - v2.5 Kernel#yield_self
18
+ - v2.5 String#casecmp
19
+ - v2.5 String#casecmp?
20
+ - v2.5 String#delete_prefix
21
+ - v2.5 String#delete_prefix!
22
+ - v2.5 String#delete_suffix
23
+ - v2.5 String#delete_suffix!
24
+ - v2.5 String#start_with?
25
+
26
+ ## Fixed
27
+
28
+ The following threw a `NoMethodError` instead of a `TypeError` when an
29
+ incorrect type was passed:
30
+
31
+ - v2.4 Float#ceil
32
+ - v2.4 Float#floor
33
+ - v2.4 Float#truncate
34
+ - v2.4 Integer#ceil
35
+ - v2.4 Integer#digits
36
+ - v2.4 Integer#floor
37
+ - v2.4 Integer#round
38
+ - v2.4 Integer#truncate
39
+ - v2.4 String#casecmp?
40
+
1
41
  # [1.0.1][] (2017-06-03)
2
42
 
3
43
  ## Fixed
@@ -174,6 +214,7 @@
174
214
  - v2.4 String#concat?
175
215
  - v2.4 String#prepend?
176
216
 
217
+ [1.1.0]: https://github.com/AaronLasseigne/polyfill/compare/v1.0.1...v1.1.0
177
218
  [1.0.1]: https://github.com/AaronLasseigne/polyfill/compare/v1.0.0...v1.0.1
178
219
  [1.0.0]: https://github.com/AaronLasseigne/polyfill/compare/v0.10.0...v1.0.0
179
220
  [0.10.0]: https://github.com/AaronLasseigne/polyfill/compare/v0.9.0...v0.10.0
@@ -9,7 +9,8 @@ please add it to the documentation.
9
9
 
10
10
  A list of changes can be found at:
11
11
 
12
- * https://raw.githubusercontent.com/ruby/ruby/v2_4_1/NEWS
12
+ * https://raw.githubusercontent.com/ruby/ruby/v2_5_0/NEWS
13
+ * https://raw.githubusercontent.com/ruby/ruby/v2_4_2/NEWS
13
14
  * https://raw.githubusercontent.com/ruby/ruby/v2_3_4/NEWS
14
15
  * https://raw.githubusercontent.com/ruby/ruby/v2_2_7/NEWS
15
16
 
data/README.md CHANGED
@@ -17,6 +17,7 @@ monkey patching** that may cause issues outside of your use.
17
17
  - [Polyfill](#polyfill-1)
18
18
  - [Polyfill.get](#polyfillget)
19
19
  - [Implementation Table](#implementation-table)
20
+ - [2.5](#25)
20
21
  - [2.4](#24)
21
22
  - [2.3](#23)
22
23
  - [2.2](#22)
@@ -26,7 +27,7 @@ monkey patching** that may cause issues outside of your use.
26
27
  Add it to your Gemfile:
27
28
 
28
29
  ```ruby
29
- gem 'polyfill', '~> 1.0'
30
+ gem 'polyfill', '~> 1.1'
30
31
  ```
31
32
 
32
33
  Or install it manually:
@@ -39,7 +40,7 @@ This project uses [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
39
40
 
40
41
  ## Goals
41
42
 
42
- 1. Features should ideally mimic the true behavior (including bugs, error messages, etc).
43
+ 1. Features should ideally mimic the true behavior (quirks, error messages, etc).
43
44
  2. Features should not significantly burden the runtime.
44
45
  3. Keep everything modular so users can be specific or broad in their usage.
45
46
 
@@ -119,260 +120,374 @@ end
119
120
 
120
121
  ## Implementation Table
121
122
 
123
+ ✓ = Implemented, ✗ = Not Implemented, P = Partially Implemented
124
+
125
+ Partial implemented features will be explained in the "Changes" section of the
126
+ table. The explanation will follow "**Differences:**".
127
+
128
+ ### 2.5
129
+
130
+ Attempting to modify frozen objects now throws `FrozenError` instead of
131
+ `RuntimeError`. Methods where this change occurred are not listed below even
132
+ though they have techically changed. `FrozenError` is a subclass of
133
+ `RuntimeError` so it is safe to continue rescuing `RuntimeError` if needed.
134
+
135
+ | | Object | Method | Changes |
136
+ |:-:| ---------------- | ------------------------ | ------- |
137
+ | ✗ | Array | #append | New (alias for `push`)
138
+ | ✗ | | #prepend | New (alias for `unshift`)
139
+ | ✗ | BigDecimal | #clone | Returns the receiver itself instead of making a new instance.
140
+ | ✗ | | #dup | Returns the receiver itself instead of making a new instance.
141
+ | ✗ | Dir | .children | New
142
+ | ✗ | | .each_child | New
143
+ | ✗ | | #glob | Accepts a new optional keyword argument, `:base`.
144
+ | ✗ | Enumerable | #any? | Accepts a pattern argument.
145
+ | ✗ | | #all? | Accepts a pattern argument.
146
+ | ✗ | | #none? | Accepts a pattern argument.
147
+ | ✗ | | #one? | Accepts a pattern argument.
148
+ | ✗ | ERB | .result_with_hash | New
149
+ | ✗ | Exception | #full_message | New
150
+ | ✗ | File | .identical? | Support ReFS 128bit ino on Windows 8.1 and later.
151
+ | ✗ | | .lutime | New
152
+ | ✗ | | .open | Accepts a new optional keyword argument, `:newline`.
153
+ | ✗ | | #path | Raises an `IOError` for files opened with `File::Constants::TMPFILE` option.
154
+ | ✗ | File::Stat | #atime | Support fractional second timestamps on Windows 8 and later.
155
+ | ✗ | | #ctime | Support fractional second timestamps on Windows 8 and later.
156
+ | ✗ | | #ino | Support ReFS 128bit ino on Windows 8.1 and later.
157
+ | ✗ | | #mtime | Support fractional second timestamps on Windows 8 and later.
158
+ | ✓ | Hash | #slice | New
159
+ | ✓ | | #transform_keys | New
160
+ | ✗ | | #transform_keys! | New
161
+ | ✓ | Integer | #allbits? | New
162
+ | ✓ | | #anybits? | New
163
+ | ✓ | | #ceil | Always return an Integer.
164
+ | ✓ | | #floor | Always return an Integer.
165
+ | ✓ | | #nobits? | New
166
+ | ✗ | | #pow | Same as `**` but it accepts an optional modulo argument for calculating modular exponentiation.
167
+ | ✓ | | #round | Always return an Integer.
168
+ | ✗ | | .sqrt | New
169
+ | ✓ | | #truncate | Always return an Integer.
170
+ | ✗ | IO | #pread | New
171
+ | ✗ | | #pwrite | New
172
+ | ✗ | | #write | Accepts multiple arguments.
173
+ | ✗ | IOError | #close | Instead of raising an error with the message "stream closed", the message will be "stream closed in another thread".
174
+ | ✗ | IPAddr | #link_local? | New
175
+ | ✗ | | #loopback? | New
176
+ | ✗ | | .new | No longer accepts an invalid address mask.
177
+ | ✗ | | #prefix? | New
178
+ | ✗ | | #private? | New
179
+ | ✓ | Kernel | #yield_self | New
180
+ | ✗ | | #pp | New
181
+ | ✗ | | #warn | Accepts a new optional keyword argument, `:uplevel`.
182
+ | ✗ | KeyError | #key | New
183
+ | ✗ | | #receiver | New
184
+ | ✗ | Matrix | .combine | New
185
+ | ✗ | | #combine | New
186
+ | ✗ | | #entrywise_product | New
187
+ | ✗ | | #hadamard_product | New
188
+ | ✗ | Method | #=== | New
189
+ | ✗ | Module | #attr | Is now public.
190
+ | ✗ | | #attr_accessor | Is now public.
191
+ | ✗ | | #attr_reader | Is now public.
192
+ | ✗ | | #attr_writer | Is now public.
193
+ | ✗ | | #alias_method | Is now public.
194
+ | ✗ | | #define_method | Is now public.
195
+ | ✗ | | #remove_method | Is now public.
196
+ | ✗ | | #undef_method | Is now public.
197
+ | ✗ | Net::HTTP | #max_version | New
198
+ | ✗ | | #min_version | New
199
+ | ✗ | | .new | Accepts a new optional keyword argument, `:no_proxy`.
200
+ | ✗ | | #proxy_pass | Reflects the http_proxy environment variable if the system's environment variable is multiuser safe.
201
+ | ✗ | | #proxy_user | Reflects the http_proxy environment variable if the system's environment variable is multiuser safe.
202
+ | ✗ | Numeric | #< | No longer hide exceptions from `#coerce` and will return `nil` if coercion is impossible.
203
+ | ✗ | | #<= | No longer hide exceptions from `#coerce` and will return `nil` if coercion is impossible.
204
+ | ✗ | | #> | No longer hide exceptions from `#coerce` and will return `nil` if coercion is impossible.
205
+ | ✗ | | #>= | No longer hide exceptions from `#coerce` and will return `nil` if coercion is impossible.
206
+ | ✗ | | #step | No longer hides errors from coerce method when given a step value which cannot be compared with #> to 0.
207
+ | ✗ | Pathname | #glob | New
208
+ | ✗ | Process | .last_status | New (alias of `$?`)
209
+ | ✗ | | .times | Precision is improved if getrusage(2) exists.
210
+ | ✗ | Range | .initialize | No longer hides exceptions when comparing begin and end with `<=>` and raise a "bad value for range" `ArgumentError` but instead lets the exception from the `<=>` call go through.
211
+ | ✗ | Random | #urandom | Renamed from `raw_seed`.
212
+ | ✗ | SecureRandom | .alphanumeric | New
213
+ | ✗ | Set | #=== | New (alias of `include?`)
214
+ | ✗ | | #reset | New
215
+ | ✗ | | #to_s | New (alias of `inspect`)
216
+ | ✓ | String | #casecmp | Returns `nil` for non-string arguments instead of raising a `TypeError`.
217
+ | ✓ | | #casecmp? | Returns `nil` for non-string arguments instead of raising a `TypeError`.
218
+ | ✓ | | #delete_prefix | New
219
+ | P | | #delete_prefix! | New **Differences:** Throws `RuntimeError` instead of `FrozenError` when attempting to modify a frozen string.
220
+ | ✓ | | #delete_suffix | New (alias of `chomp`)
221
+ | P | | #delete_suffix! | New (alias of `chomp!`) **Differences:** Throws `RuntimeError` instead of `FrozenError` when attempting to modify a frozen string.
222
+ | ✗ | | #each_grapheme_cluster | New
223
+ | ✗ | | #grapheme_clusters | New
224
+ | P | | #start_with? | Accepts regular expression arguments. **Differences:** Does not set `Regexp` globals.
225
+ | ✗ | | #undump | New
226
+ | ✗ | StringIO | #write | Accepts multiple arguments.
227
+ | ✗ | StringScanner | #captures | New
228
+ | ✗ | | #size | New
229
+ | ✗ | | #values_at | New
230
+ | ✗ | Struct | .new | Accepts a new optional keyword argument, `:keyword_init`.
231
+ | ✗ | Thread | #fetch | New
232
+ | ✗ | | #name= | Description set by `Thread#name=` is now visible on Windows 10.
233
+ | ✗ | Time | #at | Accepts a third argument which specifies the unit of the second argument.
234
+ | ✗ | URI | .open | New (alias of `Kernel.open`)
235
+ | ✗ | Zlib::GzipWriter | #write | Accepts multiple arguments.
236
+
122
237
  ### 2.4
123
238
 
124
- | Object | Method | Implemented | Notes |
125
- | ---------------- | ------------------------ | ----------- | ----- |
126
- | Array | #concat | Yes |
127
- | | #max | No | This method already existed but was inherited from `Enumerable`. It was optimized on `Array` so redefining `Enumerable#max` no longer affects this.
128
- | | #min | No | This method already existed but was inherited from `Enumerable`. It was optimized on `Array` so redefining `Enumerable#min` no longer affects this.
129
- | | #pack | No |
130
- | | #sum | Yes |
131
- | BasicObject | #\_\_send\_\_ | No |
132
- | Binding | #irb | No |
133
- | Comparable | #clamp | Yes |
134
- | CSV | #new | No |
135
- | Dir | .empty? | Yes |
136
- | Enumerable | #chunk | Yes |
137
- | | #sum | Yes |
138
- | | #uniq | Yes |
139
- | Enumerator::Lazy | #chunk_while | Yes |
140
- | | #uniq | Yes |
141
- | File | .empty? | Yes |
142
- | FileTest | .empty? | No |
143
- | Float | #ceil | Yes |
144
- | | #floor | Yes |
145
- | | #round | No |
146
- | | #truncate | Yes |
147
- | Hash | #compact | Yes |
148
- | | #compact! | Yes |
149
- | | #transform_values | Yes |
150
- | | #transform_values! | Yes |
151
- | Integer | #ceil | Yes |
152
- | | #digits | Yes |
153
- | | #floor | Yes |
154
- | | #round | Yes |
155
- | | #truncate | Yes |
156
- | IO | #each_line | Yes |
157
- | | .foreach | Yes |
158
- | | #gets | Yes |
159
- | | #lines | Yes |
160
- | | #readline | Yes |
161
- | | #readlines | Yes |
162
- | | .readlines | Yes |
163
- | IPAddr | #== | Yes |
164
- | | #<=> | Yes |
165
- | Kernel | #send | No |
166
- | Logger | #new | No |
167
- | MatchData | #named_captures | Yes |
168
- | | #values_at | Yes |
169
- | Module | #refine | No |
170
- | | .used_modules | No |
171
- | Net::HTTP | #post | No |
172
- | Net::FTP | #new | No |
173
- | | #status | No |
174
- | Numeric | #clone | Yes |
175
- | | #dup | Yes |
176
- | | #finite? | Yes |
177
- | | #infinite? | Yes |
178
- | Object | #clone | Yes |
179
- | OptionParser | #order | No |
180
- | | #order! | No |
181
- | | #parse | No |
182
- | | #parse! | No |
183
- | | #permute | No |
184
- | | #permute! | No |
185
- | Pathname | #empty? | Yes |
186
- | Readline | #quoting_detection_proc | No |
187
- | | #quoting_detection_proc= | No |
188
- | REXML::Element | #[] | No |
189
- | Rational | #round | No |
190
- | Regexp | #match? | Yes |
191
- | Set | #compare_by_identity | No |
192
- | | #compare_by_identity? | No |
193
- | String | #capitalize | No |
194
- | | #capitalize! | No |
195
- | | #casecmp? | Partial | Does not support Unicode characters.
196
- | | #concat | Yes |
197
- | | #downcase | No |
198
- | | #downcase! | No |
199
- | | #each_line | Yes |
200
- | | #lines | Yes |
201
- | | #match? | Yes |
202
- | | .new | Partial | Allows `:capacity` option to pass but does nothing.
203
- | | #prepend | Yes |
204
- | | #swapcase | No |
205
- | | #swapcase! | No |
206
- | | #unpack1 | Yes |
207
- | | #upcase | No |
208
- | | #upcase! | No |
209
- | StringIO | #each_line | Yes |
210
- | | #gets | Yes |
211
- | | #readline | Yes |
212
- | | #readlines | Yes |
213
- | Symbol | #capitalize | No |
214
- | | #capitalize! | No |
215
- | | #casecmp? | Partial | Does not support Unicode characters.
216
- | | #downcase | No |
217
- | | #downcase! | No |
218
- | | #match | Yes |
219
- | | #match? | Yes |
220
- | | #swapcase | No |
221
- | | #swapcase! | No |
222
- | | #to_proc | No |
223
- | | #upcase | No |
224
- | | #upcase! | No |
225
- | Thread | #report\_on\_exception | No |
226
- | | .report\_on\_exception | No |
227
- | TracePoint | #callee_id | No |
228
- | Warning | #warn | No |
239
+ | | Object | Method | Changes |
240
+ |:-:| ---------------- | ------------------------ | ------- |
241
+ | ✓ | Array | #concat | Accepts multiple arguments.
242
+ | ✗ | | #max | This method already existed but was inherited from `Enumerable`. It was optimized on `Array` so redefining `Enumerable#max` no longer affects this.
243
+ | ✗ | | #min | This method already existed but was inherited from `Enumerable`. It was optimized on `Array` so redefining `Enumerable#min` no longer affects this.
244
+ | ✗ | | #pack | Accepts a new optional keyword argument, `buffer`.
245
+ | ✓ | | #sum | Like `Enumerable#sum` but does not depend on the definition of `each`.
246
+ | ✗ | BasicObject | #\_\_send\_\_ | Supports refined methods.
247
+ | ✗ | Binding | #irb | Start a REPL session like `binding.pry`.
248
+ | ✓ | Comparable | #clamp | New
249
+ | ✗ | CSV | #new | Accepts a new optional keyword argument, `liberal_parsing`.
250
+ | ✓ | Dir | .empty? | New
251
+ | ✓ | Enumerable | #chunk | Calling without a block returns an enumerator.
252
+ | ✓ | | #sum |
253
+ | ✓ | | #uniq |
254
+ | ✓ | Enumerator::Lazy | #chunk_while |
255
+ | ✓ | | #uniq |
256
+ | ✓ | File | .empty? |
257
+ | ✗ | FileTest | .empty? |
258
+ | ✓ | Float | #ceil | Accepts an optional digits argument.
259
+ | ✓ | | #floor | Accepts an optional digits argument.
260
+ | ✗ | | #round | Accepts an optional digits argument and provides a new optional keyword argument, `half`.
261
+ | ✓ | | #truncate | Accepts an optional digits argument.
262
+ | ✓ | Hash | #compact |
263
+ | ✓ | | #compact! |
264
+ | ✓ | | #transform_values |
265
+ | ✓ | | #transform_values! |
266
+ | ✓ | Integer | #ceil | Accepts an optional digits argument.
267
+ | ✓ | | #digits |
268
+ | ✓ | | #floor | Accepts an optional digits argument.
269
+ | ✓ | | #round | Accepts an optional digits argument and provides a new optional keyword argument, `half`.
270
+ | ✓ | | #truncate | Accepts an optional digits argument.
271
+ | ✓ | IO | #each_line | Accepts a new optional keyword argument, `chomp`.
272
+ | ✓ | | .foreach | Accepts a new optional keyword argument, `chomp`.
273
+ | ✓ | | #gets | Accepts a new optional keyword argument, `chomp`.
274
+ | ✓ | | #lines |
275
+ | ✓ | | #readline |
276
+ | ✓ | | #readlines |
277
+ | ✓ | | .readlines | Accepts a new optional keyword argument, `chomp`.
278
+ | ✓ | IPAddr | #== | No longer raises an exception if coercion fails.
279
+ | ✓ | | #<=> | No longer raises an exception if coercion fails.
280
+ | ✗ | Kernel | #send | Supports refined methods.
281
+ | ✗ | Logger | #new |
282
+ | ✓ | MatchData | #named_captures |
283
+ | ✓ | | #values_at | Supports named captures.
284
+ | ✗ | Module | #refine | Accepts a module as an argument.
285
+ | ✗ | | .used_modules |
286
+ | ✗ | Net::HTTP | #post | New
287
+ | ✗ | Net::FTP | #new | Supports hash style options.
288
+ | ✗ | | #status | Accepts a new optional keyword argument, `pathname`.
289
+ | ✓ | Numeric | #clone |
290
+ | ✓ | | #dup |
291
+ | ✓ | | #finite? |
292
+ | ✓ | | #infinite? |
293
+ | ✓ | Object | #clone |
294
+ | ✗ | OptionParser | #order |
295
+ | ✗ | | #order! |
296
+ | ✗ | | #parse |
297
+ | ✗ | | #parse! |
298
+ | ✗ | | #permute |
299
+ | ✗ | | #permute! |
300
+ | ✓ | Pathname | #empty? |
301
+ | ✗ | Readline | #quoting_detection_proc |
302
+ | ✗ | | #quoting_detection_proc= |
303
+ | ✗ | REXML::Element | #[] | If `String` or `Symbol` is specified, attribute value is returned. Otherwise, Nth child is returned.
304
+ | ✗ | Rational | #round |
305
+ | ✓ | Regexp | #match? | New
306
+ | ✗ | Set | #compare_by_identity | New
307
+ | ✗ | | #compare_by_identity? | New
308
+ | ✗ | String | #capitalize | Supports Unicode and accepts several new keyword arguments.
309
+ | ✗ | | #capitalize! | Supports Unicode and accepts several new keyword arguments.
310
+ | P | | #casecmp? | New **Differences:** Does not support Unicode characters.
311
+ | ✓ | | #concat | Now accepts multiple arguments.
312
+ | ✗ | | #downcase | Supports Unicode and accepts several new keyword arguments.
313
+ | ✗ | | #downcase! | Supports Unicode and accepts several new keyword arguments.
314
+ | ✓ | | #each_line | Accepts a new optional keyword argument, `chomp`.
315
+ | ✓ | | #lines | Accepts a new optional keyword argument, `chomp`.
316
+ | ✓ | | #match? |
317
+ | P | | .new | Accepts a new optional keyword argument, `capacity`. **Differences:** Allows `:capacity` option to pass but does nothing with it.
318
+ | ✓ | | #prepend | Now accepts multiple arguments.
319
+ | ✗ | | #swapcase | Supports Unicode and accepts several new keyword arguments.
320
+ | ✗ | | #swapcase! | Supports Unicode and accepts several new keyword arguments.
321
+ | ✓ | | #unpack1 |
322
+ | ✗ | | #upcase | Supports Unicode and accepts several new keyword arguments.
323
+ | ✗ | | #upcase! | Supports Unicode and accepts several new keyword arguments.
324
+ | ✓ | StringIO | #each_line | Accepts a new optional keyword argument, `chomp`.
325
+ | ✓ | | #gets | Accepts a new optional keyword argument, `chomp`.
326
+ | ✓ | | #readline | Accepts a new optional keyword argument, `chomp`.
327
+ | ✓ | | #readlines | Accepts a new optional keyword argument, `chomp`.
328
+ | ✗ | Symbol | #capitalize | Supports Unicode and accepts several new keyword arguments.
329
+ | ✗ | | #capitalize! | Supports Unicode and accepts several new keyword arguments.
330
+ | P | | #casecmp? | New **Differences:** Does not support Unicode characters.
331
+ | ✗ | | #downcase | Supports Unicode and accepts several new keyword arguments.
332
+ | ✗ | | #downcase! | Supports Unicode and accepts several new keyword arguments.
333
+ | ✓ | | #match |
334
+ | ✓ | | #match? |
335
+ | ✗ | | #swapcase | Supports Unicode and accepts several new keyword arguments.
336
+ | ✗ | | #swapcase! | Supports Unicode and accepts several new keyword arguments.
337
+ | ✗ | | #to_proc |
338
+ | ✗ | | #upcase | Supports Unicode and accepts several new keyword arguments.
339
+ | ✗ | | #upcase! | Supports Unicode and accepts several new keyword arguments.
340
+ | ✗ | Thread | #report\_on\_exception |
341
+ | ✗ | | .report\_on\_exception |
342
+ | ✗ | TracePoint | #callee_id |
343
+ | ✗ | Warning | #warn | New
229
344
 
230
345
  ### 2.3
231
346
 
232
- | Object | Method | Implemented | Notes |
233
- | ----------------------- | ------------------------ | ----------- | ----- |
234
- | ARGF | #read_nonblock | No |
235
- | Array | #bsearch_index | No |
236
- | | #dig | Yes |
237
- | | #flatten | No |
238
- | | #flatten! | No |
239
- | | #inspect | No |
240
- | | #pack | No |
241
- | Base64 | .urlsafe_encode64 | No |
242
- | | .urlsafe_decode64 | No |
243
- | BasicSocket | #recv | No |
244
- | | #recv_nonblock | No |
245
- | | #recvmsg_nonblock | No |
246
- | | #sendmsg_nonblock | No |
247
- | Comparable | #== | No |
248
- | Coverage | .peek_result | No |
249
- | Enumerable | #chunk | No |
250
- | | #chunk_while | Yes |
251
- | | #grep_v | Yes |
252
- | | #slice_before | Yes |
253
- | Enumerator::Lazy | #grep_v | Yes |
254
- | File | .mkfifo | No |
255
- | File::Stat | #ino | No |
256
- | Hash | #< | No |
257
- | | #<= | No |
258
- | | #> | No |
259
- | | #>= | No |
260
- | | #dig | Yes |
261
- | | #fetch_values | Yes |
262
- | | #inspect | No |
263
- | | #to_proc | Partial | Works in every respect but returns a `lambda` instead of a `proc`. Returning a `proc` may be an error in MRI's implementation. See: https://bugs.ruby-lang.org/issues/12671
264
- | IO | #advise | No |
265
- | | #close | No |
266
- | | #each_codepoint | No |
267
- | | #wait_readable | No |
268
- | Kernel | #loop | Yes |
269
- | Logger | #level= | No |
270
- | | #reopen | No |
271
- | Module | #define_method | No |
272
- | | #deprecate_constant | No |
273
- | NameError | #receiver | No |
274
- | Net::FTP | .default_passive= | No |
275
- | | #mlst | No |
276
- | | #mlsd | No |
277
- | Net::HTTP | #open_timeout | No |
278
- | Numeric | #negative? | Yes |
279
- | | #positive? | Yes |
280
- | Object | #define_singleton_method | No |
281
- | | #timeout | No |
282
- | ObjectSpace | .count_symbols | No |
283
- | | .count_imemo_objects | No |
284
- | | .internal_class_of | No |
285
- | | .internal_super_of | No |
286
- | OpenSSL::SSL::SSLSocket | #accept_nonblock | No |
287
- | | #connect_nonblock | No |
288
- | Pathname | #ascend | No |
289
- | | #descend | No |
290
- | Queue | #close | No |
291
- | Socket | #accept_nonblock | No |
292
- | | #connect_nonblock | No |
293
- | String | #+@ | Yes |
294
- | | #-@ | Yes |
295
- | | .new | Yes |
296
- | | #unpack | No |
297
- | StringIO | #set_encoding | No |
298
- | Struct | #dig | Yes |
299
- | TCPServer | #accept_nonblock | No |
300
- | Thread | #name | No |
301
- | | #name= | No |
302
- | UNIXServer | #accept_nonblock | No |
303
- | Vector | #round | No |
347
+ | | Object | Method | Changes |
348
+ |:-:| ----------------------- | ------------------------ | ------- |
349
+ | ✗ | ARGF | #read_nonblock | Accepts a new optional keyword argument, `exception`.
350
+ | ✗ | Array | #bsearch_index |
351
+ | ✓ | | #dig | New
352
+ | ✗ | | #flatten | No longer calls `to_ary` on elements beyond the given level.
353
+ | ✗ | | #flatten! | No longer calls `to_ary` on elements beyond the given level.
354
+ | ✗ | | #inspect | No longer raises an error if its content returns a string which is not compatible with `Encoding.default_external`.
355
+ | ✗ | | #pack | Add `j` and `J` directives for pointer width integer type.
356
+ | ✗ | Base64 | .urlsafe_encode64 | Accepts a new optional keyword argument, `padding`.
357
+ | ✗ | | .urlsafe_decode64 | Accepts a new optional keyword argument, `padding`.
358
+ | ✗ | BasicSocket | #recv | Allow an output `String` buffer argument.
359
+ | ✗ | | #recv_nonblock | Allow an output `String` buffer argument.
360
+ | ✗ | | #recvmsg_nonblock | Accepts a new keyword argument, `exception`.
361
+ | ✗ | | #sendmsg_nonblock | Accepts a new keyword argument, `exception`.
362
+ | ✗ | Comparable | #== | No longer rescues exceptions.
363
+ | ✗ | Coverage | .peek_result | New
364
+ | ✗ | Enumerable | #chunk | No longer accepts the `initial_state` keyword argument.
365
+ | ✓ | | #chunk_while |
366
+ | ✓ | | #grep_v | New
367
+ | ✓ | | #slice_before | No longer accepts the `initial_state` keyword argument.
368
+ | ✓ | Enumerator::Lazy | #grep_v | New
369
+ | ✗ | File | .mkfifo |
370
+ | ✗ | File::Stat | #ino | On Windows, it always returned `0`, but now returns `BY_HANDLE_FILE_INFORMATION.nFileIndexHigh/Low`.
371
+ | ✗ | Hash | #< |
372
+ | ✗ | | #<= |
373
+ | ✗ | | #> |
374
+ | ✗ | | #>= |
375
+ | ✓ | | #dig | New
376
+ | ✓ | | #fetch_values |
377
+ | ✗ | | #inspect | No longer raises an error if its content returns a string which is not compatible with `Encoding.default_external`.
378
+ | P | | #to_proc | New **Differences:** Works in every respect but returns a `lambda` instead of a `proc`. Returning a `proc` may be an error in MRI's implementation. See: https://bugs.ruby-lang.org/issues/12671)
379
+ | ✗ | IO | #advise | No longer raises Errno::ENOSYS in cases where it was detected at build time but not available at runtime.
380
+ | ✗ | | #close | Doesn't raise when the IO object is closed.
381
+ | ✗ | | #each_codepoint | Raises an exception at incomplete character before EOF when conversion takes place.
382
+ | ✗ | | #wait_readable | No longer checks FIONREAD.
383
+ | ✓ | Kernel | #loop | When stopped by a StopIteration exception, returns what the enumerator has returned instead of nil.
384
+ | ✗ | Logger | #level= |
385
+ | ✗ | | #reopen | New
386
+ | ✗ | Module | #define_method | Now requires a method body, `Proc`, `Method`, or a block.
387
+ | ✗ | | #deprecate_constant |
388
+ | ✗ | NameError | #receiver | New
389
+ | ✗ | Net::FTP | .default_passive= | New
390
+ | ✗ | | #mlst | New
391
+ | ✗ | | #mlsd | New
392
+ | ✗ | Net::HTTP | #open_timeout | Now has a default value of `60`.
393
+ | ✓ | Numeric | #negative? | New
394
+ | ✓ | | #positive? | New
395
+ | ✗ | Object | #define_singleton_method | Now requires a method body, `Proc`, `Method`, or a block.
396
+ | ✗ | | #timeout | Warns that it is deprecated.
397
+ | ✗ | ObjectSpace | .count_symbols | New
398
+ | ✗ | | .count_imemo_objects | New
399
+ | ✗ | | .internal_class_of | New
400
+ | ✗ | | .internal_super_of | New
401
+ | ✗ | OpenSSL::SSL::SSLSocket | #accept_nonblock | Accepts a new keyword argument, `exception`.
402
+ | ✗ | | #connect_nonblock | Accepts a new keyword argument, `exception`.
403
+ | ✗ | Pathname | #ascend |
404
+ | ✗ | | #descend |
405
+ | ✗ | Queue | #close |
406
+ | ✗ | Socket | #accept_nonblock | Accepts a new keyword argument, `exception`.
407
+ | ✗ | | #connect_nonblock | Accepts a new keyword argument, `exception`.
408
+ | ✓ | String | #+@ | New
409
+ | ✓ | | #-@ | New
410
+ | ✓ | | .new | Accepts a new keyword argument, `encoding`.
411
+ | ✗ | | #unpack | Add `j` and `J` directives for pointer width integer type.
412
+ | ✗ | StringIO | #set_encoding | No longer sets the encoding of its buffer string.
413
+ | ✓ | Struct | #dig | New
414
+ | ✗ | TCPServer | #accept_nonblock | Accepts a new keyword argument, `exception`.
415
+ | ✗ | Thread | #name | New
416
+ | ✗ | | #name= | New
417
+ | ✗ | UNIXServer | #accept_nonblock | Accepts a new keyword argument, `exception`.
418
+ | ✗ | Vector | #round | New
304
419
 
305
420
  ### 2.2
306
421
 
307
- | Object | Method | Implemented | Notes |
308
- | ---------- | --------------------------------------- | ----------- | ----- |
309
- | Binding | #local_variables | No |
310
- | | #receiver | No |
311
- | Dir | #fileno | No |
312
- | Enumerable | #max | Yes |
313
- | | #max_by | Yes |
314
- | | #min | Yes |
315
- | | #min_by | Yes |
316
- | | #slice_after | Yes |
317
- | | #slice_when | Yes |
318
- | Etc | .confstr | No |
319
- | | .sysconf | No |
320
- | | .nprocessors | No |
321
- | | .uname | No |
322
- | Float | #next_float | No |
323
- | | #prev_float | No |
324
- | File | .birthtime | No |
325
- | | #birthtime | No |
326
- | File::Stat | #birthtime | No |
327
- | Find | .find | No |
328
- | GC | .latest_gc_info | No |
329
- | | .stat | No |
330
- | IO | #each_codepoint | No |
331
- | | #nonblock_read | No |
332
- | | #nonblock_write | No |
333
- | | #pathconf | No |
334
- | Kernel | #itself | Yes |
335
- | | #throw | No |
336
- | Math | .atan2 | No |
337
- | | .log | No |
338
- | Matrix | #+@ | No |
339
- | | #-@ | No |
340
- | | #adjugate | No |
341
- | | #cofactor | No |
342
- | | #first_minor | No |
343
- | | .hstack | No |
344
- | | #hstack | No |
345
- | | #laplace_expansion | No |
346
- | | .vstack | No |
347
- | | #vstack | No |
348
- | Method | #curry | No |
349
- | | #super_method | No |
350
- | ObjectSpace | .memsize_of | No |
351
- | Pathname | #/ | No |
352
- | | #birthtime | No |
353
- | | #find | No |
354
- | Prime | .prime? | No |
355
- | Process | .spawn | No |
356
- | String | #unicode_normalize | No |
357
- | | #unicode_normalize! | No |
358
- | | #unicode_normalized? | No |
359
- | Time | .httpdate | No |
360
- | | .parse | No |
361
- | | .rfc2822 | No |
362
- | | .strptime | No |
363
- | | .xmlschema | No |
364
- | TSort | .each_strongly_connected_component | No |
365
- | | .each_strongly_connected_component_from | No |
366
- | | .tsort_each | No |
367
- | Vector | #+@ | Yes |
368
- | | #-@ | No |
369
- | | #angle_with | No |
370
- | | .basis | No |
371
- | | #cross | No |
372
- | | #cross_product | No |
373
- | | #dot | No |
374
- | | .independent? | No |
375
- | | #independent? | No |
422
+ | | Object | Method | Changes |
423
+ |:-:| ---------- | --------------------------------------- | ------- |
424
+ | ✗ | Binding | #local_variables | New
425
+ | ✗ | | #receiver | New
426
+ | ✗ | Dir | #fileno | New
427
+ | ✓ | Enumerable | #max | Accepts a new optional argument to return multiple elements.
428
+ | ✓ | | #max_by | Accepts a new optional argument to return multiple elements.
429
+ | ✓ | | #min | Accepts a new optional argument to return multiple elements.
430
+ | ✓ | | #min_by | Accepts a new optional argument to return multiple elements.
431
+ | ✓ | | #slice_after | New
432
+ | ✓ | | #slice_when | New
433
+ | ✗ | Etc | .confstr | New
434
+ | ✗ | | .sysconf | New
435
+ | ✗ | | .nprocessors | New
436
+ | ✗ | | .uname | New
437
+ | ✗ | Float | #next_float | New
438
+ | ✗ | | #prev_float | New
439
+ | ✗ | File | .birthtime | New
440
+ | ✗ | | #birthtime | New
441
+ | ✗ | File::Stat | #birthtime | New
442
+ | ✗ | Find | .find | Accepts a new optional keyword argument, `ignore_error`.
443
+ | ✗ | GC | .latest_gc_info |
444
+ | ✗ | | .stat |
445
+ | ✗ | IO | #each_codepoint |
446
+ | ✗ | | #nonblock_read | Supports pipes on Windows.
447
+ | ✗ | | #nonblock_write | Supports pipes on Windows.
448
+ | ✗ | | #pathconf | New
449
+ | ✓ | Kernel | #itself | New
450
+ | ✗ | | #throw | Raises `UncaughtThrowError`, subclass of `ArgumentError` when there is no corresponding catch block, instead of `ArgumentError`.
451
+ | ✗ | Math | .atan2 | Now returns values like as expected by C99 if both two arguments are infinity.
452
+ | ✗ | | .log | Now raises `Math::DomainError` instead of returning `NaN` if the base is less than 0, and returns `NaN` instead of -infinity if both of two arguments are 0.
453
+ | ✗ | Matrix | #+@ | New
454
+ | ✗ | | #-@ | New
455
+ | ✗ | | #adjugate | New
456
+ | ✗ | | #cofactor | New
457
+ | ✗ | | #first_minor | New
458
+ | ✗ | | .hstack | New
459
+ | ✗ | | #hstack | New
460
+ | ✗ | | #laplace_expansion | New
461
+ | ✗ | | .vstack | New
462
+ | ✗ | | #vstack | New
463
+ | ✗ | Method | #curry | New
464
+ | ✗ | | #super_method | New
465
+ | ✗ | ObjectSpace | .memsize_of |
466
+ | ✗ | Pathname | #/ | New (alias of `#+`)
467
+ | ✗ | | #birthtime | New
468
+ | ✗ | | #find | Accepts a new optional keyword argument, `ignore_error`.
469
+ | ✗ | Prime | .prime? | Now returns `false` for negative numbers.
470
+ | ✗ | Process | .spawn |
471
+ | ✗ | String | #unicode_normalize | New
472
+ | ✗ | | #unicode_normalize! | New
473
+ | ✗ | | #unicode_normalized? | New
474
+ | ✗ | Time | .httpdate |
475
+ | ✗ | | .parse | May produce fixed-offset `Time` objects.
476
+ | ✗ | | .rfc2822 | May produce fixed-offset `Time` objects.
477
+ | ✗ | | .strptime | May produce fixed-offset `Time` objects. Raises `ArgumentError` when there is no date information.
478
+ | ✗ | | .xmlschema | May produce fixed-offset `Time` objects.
479
+ | ✗ | TSort | .each_strongly_connected_component | Returns an enumerator if no block is given.
480
+ | ✗ | | .each_strongly_connected_component_from | Returns an enumerator if no block is given.
481
+ | ✗ | | .tsort_each | Returns an enumerator if no block is given.
482
+ | ✓ | Vector | #+@ | New
483
+ | ✗ | | #-@ | New
484
+ | ✗ | | #angle_with | New
485
+ | ✗ | | .basis | New
486
+ | ✗ | | #cross | New (alias of `#cross_product`)
487
+ | ✗ | | #cross_product | New
488
+ | ✗ | | #dot | New (alias of `#inner_product`)
489
+ | ✗ | | .independent? | New
490
+ | ✗ | | #independent? | New
376
491
 
377
492
  ## Contributing
378
493
 
@@ -230,3 +230,4 @@ end
230
230
  require 'polyfill/v2_2'
231
231
  require 'polyfill/v2_3'
232
232
  require 'polyfill/v2_4'
233
+ require 'polyfill/v2_5'
@@ -3,7 +3,8 @@ module Polyfill
3
3
  VERSIONS = {
4
4
  '2.2' => 'V2_2',
5
5
  '2.3' => 'V2_3',
6
- '2.4' => 'V2_4'
6
+ '2.4' => 'V2_4',
7
+ '2.5' => 'V2_5'
7
8
  }.freeze
8
9
  private_constant :VERSIONS
9
10
 
@@ -89,5 +90,23 @@ module Polyfill
89
90
  Polyfill::Module.const_set("M#{mod.object_id}", mod)
90
91
  end
91
92
  module_function :create_module
93
+
94
+ def to_str(obj)
95
+ unless obj.respond_to?(:to_str)
96
+ raise TypeError, "no implicit conversion of #{obj.class} into String"
97
+ end
98
+
99
+ obj.to_str
100
+ end
101
+ module_function :to_str
102
+
103
+ def to_int(obj)
104
+ unless obj.respond_to?(:to_int)
105
+ raise TypeError, "no implicit conversion of #{obj.class} into Integer"
106
+ end
107
+
108
+ obj.to_int
109
+ end
110
+ module_function :to_int
92
111
  end
93
112
  end
@@ -25,15 +25,16 @@ module Polyfill
25
25
  end
26
26
 
27
27
  def fetch_values(*keys)
28
- keys.each_with_object([]) do |key, values|
29
- value =
30
- if block_given?
31
- fetch(key, &::Proc.new)
32
- else
33
- fetch(key)
34
- end
28
+ if block_given?
29
+ block = ::Proc.new
35
30
 
36
- values << value
31
+ keys.each_with_object([]) do |key, values|
32
+ values << fetch(key, &block)
33
+ end
34
+ else
35
+ keys.each_with_object([]) do |key, values|
36
+ values << fetch(key)
37
+ end
37
38
  end
38
39
  end
39
40
 
@@ -3,7 +3,7 @@ require_relative 'numeric'
3
3
  module Polyfill
4
4
  module V2_4
5
5
  module Array
6
- using Polyfill(Numeric: %w[#dup])
6
+ using Polyfill(Numeric: %w[#dup], version: '2.4')
7
7
 
8
8
  def concat(*others)
9
9
  return super if others.length == 1
@@ -3,7 +3,7 @@ require_relative 'numeric'
3
3
  module Polyfill
4
4
  module V2_4
5
5
  module Enumerable
6
- using Polyfill(Numeric: %w[#dup])
6
+ using Polyfill(Numeric: %w[#dup], version: '2.4')
7
7
 
8
8
  def chunk(*)
9
9
  return enum_for(:chunk) unless block_given?
@@ -2,7 +2,7 @@ module Polyfill
2
2
  module V2_4
3
3
  module Enumerator
4
4
  module Lazy
5
- using Polyfill(Enumerable: %w[#chunk_while])
5
+ using Polyfill(Enumerable: %w[#chunk_while], version: '2.4')
6
6
 
7
7
  def chunk_while
8
8
  super.lazy
@@ -2,7 +2,7 @@ module Polyfill
2
2
  module V2_4
3
3
  module Float
4
4
  def ceil(ndigits = 0)
5
- ndigits = ndigits.to_int
5
+ ndigits = InternalUtils.to_int(ndigits)
6
6
  return super() if ndigits == 0
7
7
 
8
8
  if ndigits > 0
@@ -15,7 +15,7 @@ module Polyfill
15
15
  end
16
16
 
17
17
  def floor(ndigits = 0)
18
- ndigits = ndigits.to_int
18
+ ndigits = InternalUtils.to_int(ndigits)
19
19
  return super() if ndigits == 0
20
20
 
21
21
  if ndigits > 0
@@ -28,7 +28,7 @@ module Polyfill
28
28
  end
29
29
 
30
30
  def truncate(ndigits = 0)
31
- ndigits = ndigits.to_int
31
+ ndigits = InternalUtils.to_int(ndigits)
32
32
  return super() if ndigits == 0
33
33
 
34
34
  if ndigits > 0
@@ -2,7 +2,7 @@ module Polyfill
2
2
  module V2_4
3
3
  module Integer
4
4
  def ceil(ndigits = 0)
5
- ndigits = ndigits.to_int
5
+ ndigits = InternalUtils.to_int(ndigits)
6
6
  return super() if ndigits == 0
7
7
  return to_f if ndigits > 0
8
8
 
@@ -11,7 +11,7 @@ module Polyfill
11
11
  end
12
12
 
13
13
  def digits(base = 10)
14
- base = base.to_int
14
+ base = InternalUtils.to_int(base)
15
15
  raise Math::DomainError, 'out of domain' if self < 0
16
16
  raise ArgumentError, 'negative radix' if base < 0
17
17
  raise ArgumentError, "invalid radix #{base}" if base < 2
@@ -26,7 +26,7 @@ module Polyfill
26
26
  end
27
27
 
28
28
  def floor(ndigits = 0)
29
- ndigits = ndigits.to_int
29
+ ndigits = InternalUtils.to_int(ndigits)
30
30
  return super() if ndigits == 0
31
31
  return to_f if ndigits > 0
32
32
 
@@ -38,7 +38,7 @@ module Polyfill
38
38
  unless [nil, :down, :even, :up, 'down', 'even', 'up'].include?(half)
39
39
  raise ArgumentError, "invalid rounding mode: #{half}"
40
40
  end
41
- ndigits = ndigits.to_int
41
+ ndigits = InternalUtils.to_int(ndigits)
42
42
  return super() if ndigits == 0
43
43
  return to_f if ndigits > 0
44
44
 
@@ -47,7 +47,7 @@ module Polyfill
47
47
  end
48
48
 
49
49
  def truncate(ndigits = 0)
50
- ndigits = ndigits.to_int
50
+ ndigits = InternalUtils.to_int(ndigits)
51
51
  return super() if ndigits == 0
52
52
  return to_f if ndigits > 0
53
53
 
@@ -13,7 +13,7 @@ module Polyfill
13
13
  end
14
14
 
15
15
  def casecmp?(other)
16
- casecmp(other.to_str) == 0
16
+ casecmp(InternalUtils.to_str(other)) == 0
17
17
  end
18
18
 
19
19
  def concat(*others)
@@ -0,0 +1,9 @@
1
+ require_relative 'v2_5/hash'
2
+ require_relative 'v2_5/integer'
3
+ require_relative 'v2_5/kernel'
4
+ require_relative 'v2_5/string'
5
+
6
+ module Polyfill
7
+ module V2_5
8
+ end
9
+ end
@@ -0,0 +1,25 @@
1
+ module Polyfill
2
+ module V2_5
3
+ module Hash
4
+ def slice(*keys)
5
+ keys.each_with_object({}) do |k, acc|
6
+ acc[k] = self[k] if key?(k)
7
+ end
8
+ end
9
+
10
+ def transform_keys
11
+ unless block_given?
12
+ return ::Enumerator.new(keys.size) do |yielder|
13
+ each_with_object({}) do |(k, v), acc|
14
+ acc[yielder.yield(k)] = v
15
+ end
16
+ end
17
+ end
18
+
19
+ each_with_object({}) do |(k, v), acc|
20
+ acc[yield(k)] = v
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,36 @@
1
+ module Polyfill
2
+ module V2_5
3
+ module Integer
4
+ using Polyfill(Integer: %w[#ceil #floor #round #truncate], version: '2.4')
5
+
6
+ def ceil(*)
7
+ super.to_i
8
+ end
9
+
10
+ def floor(*)
11
+ super.to_i
12
+ end
13
+
14
+ def round(*)
15
+ super.to_i
16
+ end
17
+
18
+ def truncate(*)
19
+ super.to_i
20
+ end
21
+
22
+ def allbits?(mask)
23
+ imask = InternalUtils.to_int(mask)
24
+ self & imask == imask
25
+ end
26
+
27
+ def anybits?(mask)
28
+ self & InternalUtils.to_int(mask) != 0
29
+ end
30
+
31
+ def nobits?(mask)
32
+ self & InternalUtils.to_int(mask) == 0
33
+ end
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,15 @@
1
+ module Polyfill
2
+ module V2_5
3
+ module Kernel
4
+ def yield_self
5
+ unless block_given?
6
+ return ::Enumerator.new(1) do |yielder|
7
+ yielder.yield(self)
8
+ end
9
+ end
10
+
11
+ yield(self)
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,43 @@
1
+ module Polyfill
2
+ module V2_5
3
+ module String
4
+ def casecmp(other_str)
5
+ super
6
+ rescue TypeError
7
+ nil
8
+ end
9
+
10
+ def casecmp?(other_str)
11
+ super
12
+ rescue TypeError
13
+ nil
14
+ end
15
+
16
+ def delete_prefix(prefix)
17
+ sub(/\A#{InternalUtils.to_str(prefix)}/, ''.freeze)
18
+ end
19
+
20
+ def delete_prefix!(prefix)
21
+ prev = dup
22
+ current = sub!(/\A#{InternalUtils.to_str(prefix)}/, ''.freeze)
23
+ prev == current ? nil : current
24
+ end
25
+
26
+ def delete_suffix(suffix)
27
+ chomp(suffix)
28
+ end
29
+
30
+ def delete_suffix!(suffix)
31
+ chomp!(suffix)
32
+ end
33
+
34
+ def start_with?(*prefixes)
35
+ super if prefixes.grep(Regexp).empty?
36
+
37
+ prefixes.any? do |prefix|
38
+ prefix.is_a?(Regexp) ? self[/\A#{prefix}/] : super(prefix)
39
+ end
40
+ end
41
+ end
42
+ end
43
+ end
@@ -1,3 +1,3 @@
1
1
  module Polyfill
2
- VERSION = '1.0.1'.freeze
2
+ VERSION = Gem::Version.new('1.1.0'.freeze)
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: polyfill
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aaron Lasseigne
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-06-03 00:00:00.000000000 Z
11
+ date: 2018-02-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -120,6 +120,11 @@ files:
120
120
  - lib/polyfill/v2_4/string.rb
121
121
  - lib/polyfill/v2_4/string_io.rb
122
122
  - lib/polyfill/v2_4/symbol.rb
123
+ - lib/polyfill/v2_5.rb
124
+ - lib/polyfill/v2_5/hash.rb
125
+ - lib/polyfill/v2_5/integer.rb
126
+ - lib/polyfill/v2_5/kernel.rb
127
+ - lib/polyfill/v2_5/string.rb
123
128
  - lib/polyfill/version.rb
124
129
  - polyfill.gemspec
125
130
  homepage: ''
@@ -142,7 +147,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
142
147
  version: '0'
143
148
  requirements: []
144
149
  rubyforge_project:
145
- rubygems_version: 2.6.11
150
+ rubygems_version: 2.7.3
146
151
  signing_key:
147
152
  specification_version: 4
148
153
  summary: Adds newer Ruby methods to older versions.