README.md in polyfill-1.1.0 vs README.md in polyfill-1.2.0

- old
+ new

@@ -25,11 +25,11 @@ ## Installation Add it to your Gemfile: ```ruby -gem 'polyfill', '~> 1.1' +gem 'polyfill', '~> 1.2' ``` Or install it manually: ```sh @@ -49,11 +49,11 @@ ### Polyfill With the `Polyfill` method, you can polyfill methods for one or more Ruby objects. Each object is passed as a key. The value is an array of strings containing the methods you would like to polyfill. Instance methods need to -start with '#' and class methods need to start with '.'. +start with "#" and class methods need to start with ".". ```ruby using Polyfill( Array: %w[#concat], Dir: %w[.empty?], @@ -134,14 +134,14 @@ | | Object | Method | Changes | |:-:| ---------------- | ------------------------ | ------- | | ✗ | Array | #append | New (alias for `push`) | ✗ | | #prepend | New (alias for `unshift`) -| ✗ | BigDecimal | #clone | Returns the receiver itself instead of making a new instance. -| ✗ | | #dup | Returns the receiver itself instead of making a new instance. -| ✗ | Dir | .children | New -| ✗ | | .each_child | New +| ✓ | BigDecimal | #clone | Returns the receiver itself instead of making a new instance. +| ✓ | | #dup | Returns the receiver itself instead of making a new instance. +| ✓ | Dir | .children | New +| ✓ | | .each_child | New | ✗ | | #glob | Accepts a new optional keyword argument, `:base`. | ✗ | Enumerable | #any? | Accepts a pattern argument. | ✗ | | #all? | Accepts a pattern argument. | ✗ | | #none? | Accepts a pattern argument. | ✗ | | #one? | Accepts a pattern argument. @@ -163,11 +163,11 @@ | ✓ | | #ceil | Always return an Integer. | ✓ | | #floor | Always return an Integer. | ✓ | | #nobits? | New | ✗ | | #pow | Same as `**` but it accepts an optional modulo argument for calculating modular exponentiation. | ✓ | | #round | Always return an Integer. -| ✗ | | .sqrt | New +| ✓ | | .sqrt | New | ✓ | | #truncate | Always return an Integer. | ✗ | IO | #pread | New | ✗ | | #pwrite | New | ✗ | | #write | Accepts multiple arguments. | ✗ | IOError | #close | Instead of raising an error with the message "stream closed", the message will be "stream closed in another thread". @@ -228,11 +228,11 @@ | ✗ | | #size | New | ✗ | | #values_at | New | ✗ | Struct | .new | Accepts a new optional keyword argument, `:keyword_init`. | ✗ | Thread | #fetch | New | ✗ | | #name= | Description set by `Thread#name=` is now visible on Windows 10. -| ✗ | Time | #at | Accepts a third argument which specifies the unit of the second argument. +| ✓ | Time | .at | Accepts a third argument which specifies the unit of the second argument. | ✗ | URI | .open | New (alias of `Kernel.open`) | ✗ | Zlib::GzipWriter | #write | Accepts multiple arguments. ### 2.4 @@ -247,63 +247,63 @@ | ✗ | Binding | #irb | Start a REPL session like `binding.pry`. | ✓ | Comparable | #clamp | New | ✗ | CSV | #new | Accepts a new optional keyword argument, `liberal_parsing`. | ✓ | Dir | .empty? | New | ✓ | Enumerable | #chunk | Calling without a block returns an enumerator. -| ✓ | | #sum | -| ✓ | | #uniq | -| ✓ | Enumerator::Lazy | #chunk_while | -| ✓ | | #uniq | -| ✓ | File | .empty? | -| ✗ | FileTest | .empty? | +| ✓ | | #sum | New +| ✓ | | #uniq | New +| ✓ | Enumerator::Lazy | #chunk_while | New +| ✓ | | #uniq | New +| ✓ | File | .empty? | New (alias of `zero?`) +| ✗ | FileTest | .empty? | New (alias of `zero?`) | ✓ | Float | #ceil | Accepts an optional digits argument. | ✓ | | #floor | Accepts an optional digits argument. | ✗ | | #round | Accepts an optional digits argument and provides a new optional keyword argument, `half`. | ✓ | | #truncate | Accepts an optional digits argument. -| ✓ | Hash | #compact | -| ✓ | | #compact! | -| ✓ | | #transform_values | -| ✓ | | #transform_values! | +| ✓ | Hash | #compact | New +| ✓ | | #compact! | New +| ✓ | | #transform_values | New +| ✓ | | #transform_values! | New | ✓ | Integer | #ceil | Accepts an optional digits argument. -| ✓ | | #digits | +| ✓ | | #digits | New | ✓ | | #floor | Accepts an optional digits argument. | ✓ | | #round | Accepts an optional digits argument and provides a new optional keyword argument, `half`. | ✓ | | #truncate | Accepts an optional digits argument. | ✓ | IO | #each_line | Accepts a new optional keyword argument, `chomp`. | ✓ | | .foreach | Accepts a new optional keyword argument, `chomp`. | ✓ | | #gets | Accepts a new optional keyword argument, `chomp`. -| ✓ | | #lines | -| ✓ | | #readline | -| ✓ | | #readlines | +| ✓ | | #lines | Accepts a new optional keyword argument, `chomp`. +| ✓ | | #readline | Accepts a new optional keyword argument, `chomp`. +| ✓ | | #readlines | Accepts a new optional keyword argument, `chomp`. | ✓ | | .readlines | Accepts a new optional keyword argument, `chomp`. | ✓ | IPAddr | #== | No longer raises an exception if coercion fails. | ✓ | | #<=> | No longer raises an exception if coercion fails. | ✗ | Kernel | #send | Supports refined methods. -| ✗ | Logger | #new | -| ✓ | MatchData | #named_captures | +| ✗ | Logger | #new | Allow specifying logger parameters in constructor such as `level`, `progname`, `datetime_format`, `formatter`. Add `shift_period_suffix` option. +| ✓ | MatchData | #named_captures | New | ✓ | | #values_at | Supports named captures. | ✗ | Module | #refine | Accepts a module as an argument. -| ✗ | | .used_modules | +| ✗ | | .used_modules | New | ✗ | Net::HTTP | #post | New | ✗ | Net::FTP | #new | Supports hash style options. | ✗ | | #status | Accepts a new optional keyword argument, `pathname`. -| ✓ | Numeric | #clone | -| ✓ | | #dup | -| ✓ | | #finite? | -| ✓ | | #infinite? | -| ✓ | Object | #clone | -| ✗ | OptionParser | #order | -| ✗ | | #order! | -| ✗ | | #parse | -| ✗ | | #parse! | -| ✗ | | #permute | -| ✗ | | #permute! | -| ✓ | Pathname | #empty? | -| ✗ | Readline | #quoting_detection_proc | -| ✗ | | #quoting_detection_proc= | +| ✓ | Numeric | #clone | Returns self instead of raising an error. +| ✓ | | #dup | Returns self instead of raising an error. +| ✓ | | #finite? | New +| ✓ | | #infinite? | New +| ✓ | Object | #clone | Accepts a new optional keyword argument, `freeze`. +| ✗ | OptionParser | #order | Accepts a new optional keyword argument, `into`. +| ✗ | | #order! | Accepts a new optional keyword argument, `into`. +| ✗ | | #parse | Accepts a new optional keyword argument, `into`. +| ✗ | | #parse! | Accepts a new optional keyword argument, `into`. +| ✗ | | #permute | Accepts a new optional keyword argument, `into`. +| ✗ | | #permute! | Accepts a new optional keyword argument, `into`. +| ✓ | Pathname | #empty? | New +| ✗ | Readline | #quoting_detection_proc | New +| ✗ | | #quoting_detection_proc= | New | ✗ | REXML::Element | #[] | If `String` or `Symbol` is specified, attribute value is returned. Otherwise, Nth child is returned. -| ✗ | Rational | #round | +| ✗ | Rational | #round | Accepts a new optional keyword argument, `half`. | ✓ | Regexp | #match? | New | ✗ | Set | #compare_by_identity | New | ✗ | | #compare_by_identity? | New | ✗ | String | #capitalize | Supports Unicode and accepts several new keyword arguments. | ✗ | | #capitalize! | Supports Unicode and accepts several new keyword arguments. @@ -311,16 +311,16 @@ | ✓ | | #concat | Now accepts multiple arguments. | ✗ | | #downcase | Supports Unicode and accepts several new keyword arguments. | ✗ | | #downcase! | Supports Unicode and accepts several new keyword arguments. | ✓ | | #each_line | Accepts a new optional keyword argument, `chomp`. | ✓ | | #lines | Accepts a new optional keyword argument, `chomp`. -| ✓ | | #match? | +| ✓ | | #match? | New | P | | .new | Accepts a new optional keyword argument, `capacity`. **Differences:** Allows `:capacity` option to pass but does nothing with it. | ✓ | | #prepend | Now accepts multiple arguments. | ✗ | | #swapcase | Supports Unicode and accepts several new keyword arguments. | ✗ | | #swapcase! | Supports Unicode and accepts several new keyword arguments. -| ✓ | | #unpack1 | +| ✓ | | #unpack1 | New | ✗ | | #upcase | Supports Unicode and accepts several new keyword arguments. | ✗ | | #upcase! | Supports Unicode and accepts several new keyword arguments. | ✓ | StringIO | #each_line | Accepts a new optional keyword argument, `chomp`. | ✓ | | #gets | Accepts a new optional keyword argument, `chomp`. | ✓ | | #readline | Accepts a new optional keyword argument, `chomp`. @@ -328,28 +328,30 @@ | ✗ | Symbol | #capitalize | Supports Unicode and accepts several new keyword arguments. | ✗ | | #capitalize! | Supports Unicode and accepts several new keyword arguments. | P | | #casecmp? | New **Differences:** Does not support Unicode characters. | ✗ | | #downcase | Supports Unicode and accepts several new keyword arguments. | ✗ | | #downcase! | Supports Unicode and accepts several new keyword arguments. -| ✓ | | #match | -| ✓ | | #match? | +| ✓ | | #match | Now returns `MatchData` instead of match position. +| ✓ | | #match? | New | ✗ | | #swapcase | Supports Unicode and accepts several new keyword arguments. | ✗ | | #swapcase! | Supports Unicode and accepts several new keyword arguments. -| ✗ | | #to_proc | +| ✗ | | #to_proc | Supports refinements. | ✗ | | #upcase | Supports Unicode and accepts several new keyword arguments. | ✗ | | #upcase! | Supports Unicode and accepts several new keyword arguments. -| ✗ | Thread | #report\_on\_exception | -| ✗ | | .report\_on\_exception | -| ✗ | TracePoint | #callee_id | +| ✗ | Thread | #report\_on\_exception | New +| ✗ | | #report\_on\_exception= | New +| ✗ | | .report\_on\_exception | New +| ✗ | | .report\_on\_exception= | New +| ✗ | TracePoint | #callee_id | New | ✗ | Warning | #warn | New ### 2.3 | | Object | Method | Changes | |:-:| ----------------------- | ------------------------ | ------- | | ✗ | ARGF | #read_nonblock | Accepts a new optional keyword argument, `exception`. -| ✗ | Array | #bsearch_index | +| ✗ | Array | #bsearch_index | New | ✓ | | #dig | New | ✗ | | #flatten | No longer calls `to_ary` on elements beyond the given level. | ✗ | | #flatten! | No longer calls `to_ary` on elements beyond the given level. | ✗ | | #inspect | No longer raises an error if its content returns a string which is not compatible with `Encoding.default_external`. | ✗ | | #pack | Add `j` and `J` directives for pointer width integer type. @@ -360,33 +362,33 @@ | ✗ | | #recvmsg_nonblock | Accepts a new keyword argument, `exception`. | ✗ | | #sendmsg_nonblock | Accepts a new keyword argument, `exception`. | ✗ | Comparable | #== | No longer rescues exceptions. | ✗ | Coverage | .peek_result | New | ✗ | Enumerable | #chunk | No longer accepts the `initial_state` keyword argument. -| ✓ | | #chunk_while | +| ✓ | | #chunk_while | New | ✓ | | #grep_v | New | ✓ | | #slice_before | No longer accepts the `initial_state` keyword argument. | ✓ | Enumerator::Lazy | #grep_v | New -| ✗ | File | .mkfifo | +| ✗ | File | .mkfifo | New | ✗ | File::Stat | #ino | On Windows, it always returned `0`, but now returns `BY_HANDLE_FILE_INFORMATION.nFileIndexHigh/Low`. -| ✗ | Hash | #< | -| ✗ | | #<= | -| ✗ | | #> | -| ✗ | | #>= | +| ✗ | Hash | #< | New +| ✗ | | #<= | New +| ✗ | | #> | New +| ✗ | | #>= | New | ✓ | | #dig | New -| ✓ | | #fetch_values | +| ✓ | | #fetch_values | New | ✗ | | #inspect | No longer raises an error if its content returns a string which is not compatible with `Encoding.default_external`. | 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) | ✗ | IO | #advise | No longer raises Errno::ENOSYS in cases where it was detected at build time but not available at runtime. | ✗ | | #close | Doesn't raise when the IO object is closed. | ✗ | | #each_codepoint | Raises an exception at incomplete character before EOF when conversion takes place. | ✗ | | #wait_readable | No longer checks FIONREAD. | ✓ | Kernel | #loop | When stopped by a StopIteration exception, returns what the enumerator has returned instead of nil. -| ✗ | Logger | #level= | +| ✗ | Logger | #level= | New | ✗ | | #reopen | New | ✗ | Module | #define_method | Now requires a method body, `Proc`, `Method`, or a block. -| ✗ | | #deprecate_constant | +| ✗ | | #deprecate_constant | New | ✗ | NameError | #receiver | New | ✗ | Net::FTP | .default_passive= | New | ✗ | | #mlst | New | ✗ | | #mlsd | New | ✗ | Net::HTTP | #open_timeout | Now has a default value of `60`. @@ -398,13 +400,14 @@ | ✗ | | .count_imemo_objects | New | ✗ | | .internal_class_of | New | ✗ | | .internal_super_of | New | ✗ | OpenSSL::SSL::SSLSocket | #accept_nonblock | Accepts a new keyword argument, `exception`. | ✗ | | #connect_nonblock | Accepts a new keyword argument, `exception`. -| ✗ | Pathname | #ascend | -| ✗ | | #descend | -| ✗ | Queue | #close | +| ✗ | Pathname | #ascend | Returns an enumerator if no block is given. +| ✗ | | #descend | Returns an enumerator if no block is given. +| ✓ | Prime | .prime? | `ArgumentError` message says that an integer is expected instead of it being a comparison error. +| ✗ | Queue | #close | New | ✗ | Socket | #accept_nonblock | Accepts a new keyword argument, `exception`. | ✗ | | #connect_nonblock | Accepts a new keyword argument, `exception`. | ✓ | String | #+@ | New | ✓ | | #-@ | New | ✓ | | .new | Accepts a new keyword argument, `encoding`. @@ -438,20 +441,20 @@ | ✗ | | #prev_float | New | ✗ | File | .birthtime | New | ✗ | | #birthtime | New | ✗ | File::Stat | #birthtime | New | ✗ | Find | .find | Accepts a new optional keyword argument, `ignore_error`. -| ✗ | GC | .latest_gc_info | -| ✗ | | .stat | -| ✗ | IO | #each_codepoint | +| ✗ | GC | .latest_gc_info | Returns `:state` to represent current GC status. +| ✗ | | .stat | Some keys were renamed and new keys were added. +| ✗ | IO | #each_codepoint | Raises an exception at incomplete character before EOF when conversion takes place. | ✗ | | #nonblock_read | Supports pipes on Windows. | ✗ | | #nonblock_write | Supports pipes on Windows. | ✗ | | #pathconf | New | ✓ | Kernel | #itself | New | ✗ | | #throw | Raises `UncaughtThrowError`, subclass of `ArgumentError` when there is no corresponding catch block, instead of `ArgumentError`. | ✗ | Math | .atan2 | Now returns values like as expected by C99 if both two arguments are infinity. -| ✗ | | .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. +| ✓ | | .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. | ✗ | Matrix | #+@ | New | ✗ | | #-@ | New | ✗ | | #adjugate | New | ✗ | | #cofactor | New | ✗ | | #first_minor | New @@ -460,19 +463,19 @@ | ✗ | | #laplace_expansion | New | ✗ | | .vstack | New | ✗ | | #vstack | New | ✗ | Method | #curry | New | ✗ | | #super_method | New -| ✗ | ObjectSpace | .memsize_of | +| ✗ | ObjectSpace | .memsize_of | Returns a size including sizeof(RVALUE). | ✗ | Pathname | #/ | New (alias of `#+`) | ✗ | | #birthtime | New | ✗ | | #find | Accepts a new optional keyword argument, `ignore_error`. -| ✗ | Prime | .prime? | Now returns `false` for negative numbers. -| ✗ | Process | .spawn | +| ✓ | Prime | .prime? | Now returns `false` for negative numbers. +| ✗ | Process | .spawn | Opens the file in write mode for redirect from `[:out, :err]`. | ✗ | String | #unicode_normalize | New | ✗ | | #unicode_normalize! | New | ✗ | | #unicode_normalized? | New -| ✗ | Time | .httpdate | +| ✗ | Time | .httpdate | Always produces a UTC `Time` object. | ✗ | | .parse | May produce fixed-offset `Time` objects. | ✗ | | .rfc2822 | May produce fixed-offset `Time` objects. | ✗ | | .strptime | May produce fixed-offset `Time` objects. Raises `ArgumentError` when there is no date information. | ✗ | | .xmlschema | May produce fixed-offset `Time` objects. | ✗ | TSort | .each_strongly_connected_component | Returns an enumerator if no block is given.