README.md in polyfill-0.3.0 vs README.md in polyfill-0.4.0

- old
+ new

@@ -30,11 +30,11 @@ ## Installation Add it to your Gemfile: ```ruby -gem 'polyfill', '0.3.0' +gem 'polyfill', '0.4.0' ``` Or install it manually: ```sh @@ -67,10 +67,16 @@ Dir: %w[.empty?], Hash: %w[#compact! #transform_values], ) ``` +If you want all of the methods for a particular class you can use `:all`. + +```ruby +using Polyfill(Numeric: :all) +``` + Methods can be included in the same way. Prior to Ruby 2.4, refinements did not work on modules. In order to get methods you'll need to include them after the module. Calling `using` on a module will add it to all core Ruby classes that include it. The methods will only be included if they are needed by the Ruby version running the code. @@ -84,92 +90,116 @@ ## Implementation Table ### 2.3 to 2.4 -| Object | Method | Implemented | Notes | -| ---------------- | ---------------------- | ----------- | ----- | -| Array | #concat | Yes | -| | #max | No | -| | #min | No | -| | #pack | No | -| | #sum | No | -| Comparable | #clamp | Yes | -| Dir | .empty? | Yes | -| Enumerable | #chunk | No | -| | #sum | No | -| | #uniq | No | -| Enumerator::Lazy | #chunk_while | No | -| | #uniq | No | -| File | .empty? | Yes | -| Float | #ceil | Yes | -| | #floor | Yes | -| | #round | No | -| | #truncate | Yes | -| Hash | #compact | Yes | -| | #compact! | Yes | -| | #transform_values | Yes | -| | #transform_values! | Yes | -| Integer | #ceil | Yes | -| | #digits | Yes | -| | #floor | Yes | -| | #round | Yes | -| | #truncate | Yes | -| IO | #each_line | Yes | -| | .foreach | Yes | -| | #gets | Yes | -| | #readline | Yes | -| | #readlines | Yes | -| | .readlines | Yes | -| Kernel | #clone | No | -| MatchData | #named_captures | Yes | -| | #values_at | Yes | -| Module | #refine | No | -| | .used_modules | No | -| Numeric | #finite? | Yes | -| | #infinite? | Yes | -| Rational | #round | No | -| Regexp | #match? | No | -| String | #capitalize | No | -| | #capitalize! | No | -| | #casecmp? | No | -| | #concat | Yes | -| | #downcase | No | -| | #downcase! | No | -| | #each_line | No | -| | #lines | No | -| | #match? | No | -| | .new | No | -| | #prepend | Yes | -| | #swapcase | No | -| | #swapcase! | No | -| | #unpack1 | No | -| | #upcase | No | -| | #upcase! | No | -| StringIO | #each_line | Yes | -| | #gets | Yes | -| | #readline | Yes | -| | #readlines | Yes | -| Symbol | #capitalize | No | -| | #capitalize! | No | -| | #casecmp? | No | -| | #downcase | No | -| | #downcase! | No | -| | #match | No | -| | #match? | No | -| | #swapcase | No | -| | #swapcase! | No | -| | #upcase | No | -| | #upcase! | No | -| Thread | #report\_on\_exception | No | -| | .report\_on\_exception | No | -| TracePoint | #callee_id | No | -| Warning | #warn | No | +| Object | Method | Implemented | Notes | +| ---------------- | ------------------------ | ----------- | ----- | +| Array | #concat | Yes | +| | #max | No | This method already existed but was inherited from `Enumerable`. It was optimized on `Array` so redefining `Enumerable#max` no longer affects this. +| | #min | No | This method already existed but was inherited from `Enumerable`. It was optimized on `Array` so redefining `Enumerable#min` no longer affects this. +| | #pack | No | +| | #sum | Yes | +| Binding | #irb | No | +| Comparable | #clamp | Yes | +| CSV | #new | No | +| Dir | .empty? | Yes | +| Enumerable | #chunk | Yes | +| | #sum | Yes | +| | #uniq | Yes | +| Enumerator::Lazy | #chunk_while | Yes | +| | #uniq | Yes | +| File | .empty? | Yes | +| FileTest | .empty? | No | +| Float | #ceil | Yes | +| | #floor | Yes | +| | #round | No | +| | #truncate | Yes | +| Hash | #compact | Yes | +| | #compact! | Yes | +| | #transform_values | Yes | +| | #transform_values! | Yes | +| Integer | #ceil | Yes | +| | #digits | Yes | +| | #floor | Yes | +| | #round | Yes | +| | #truncate | Yes | +| IO | #each_line | Yes | +| | .foreach | Yes | +| | #gets | Yes | +| | #lines | Yes | +| | #readline | Yes | +| | #readlines | Yes | +| | .readlines | Yes | +| IPAddr | #== | Yes | +| | #<=> | Yes | +| Logger | #new | No | +| MatchData | #named_captures | Yes | +| | #values_at | Yes | +| Module | #refine | No | +| | .used_modules | No | +| Net::HTTP | #post | No | +| Net::FTP | #new | No | +| | #status | No | +| Numeric | #clone | Yes | +| | #dup | Yes | +| | #finite? | Yes | +| | #infinite? | Yes | +| Object | #clone | Yes | +| OptionParser | #order | No | +| | #order! | No | +| | #parse | No | +| | #parse! | No | +| | #permute | No | +| | #permute! | No | +| Pathname | #empty? | Yes | +| Readline | #quoting_detection_proc | No | +| | #quoting_detection_proc= | No | +| REXML::Element | #[] | No | +| Rational | #round | No | +| Regexp | #match? | Yes | +| Set | #compare_by_identity | No | +| | #compare_by_identity? | No | +| String | #capitalize | No | +| | #capitalize! | No | +| | #casecmp? | Partial | Does not support Unicode characters. +| | #concat | Yes | +| | #downcase | No | +| | #downcase! | No | +| | #each_line | Yes | +| | #lines | Yes | +| | #match? | Yes | +| | .new | Partial | Allows `:capacity` option to pass but does nothing. +| | #prepend | Yes | +| | #swapcase | No | +| | #swapcase! | No | +| | #unpack1 | Yes | +| | #upcase | No | +| | #upcase! | No | +| StringIO | #each_line | Yes | +| | #gets | Yes | +| | #readline | Yes | +| | #readlines | Yes | +| Symbol | #capitalize | No | +| | #capitalize! | No | +| | #casecmp? | Partial | Does not support Unicode characters. +| | #downcase | No | +| | #downcase! | No | +| | #match | Yes | +| | #match? | Yes | +| | #swapcase | No | +| | #swapcase! | No | +| | #upcase | No | +| | #upcase! | No | +| Thread | #report\_on\_exception | No | +| | .report\_on\_exception | No | +| TracePoint | #callee_id | No | +| Warning | #warn | No | ## Contributing Bug reports and pull requests are welcome on GitHub at https://github.com/AaronLasseigne/polyfill. Please read the [contributing file](CONTRIBUTING.md) prior to pull requests. ## Credits -Polyfill is licensed under the [MIT License](LICENSE.md). +Polyfill is licensed under the [MIT License](LICENSE.txt).