| |
@@ -2,6 +2,7 @@
|
| |
|
| |
[[sect-ruby]]
|
| |
= Ruby
|
| |
+ :toc:
|
| |
|
| |
== Ruby 2.7
|
| |
|
| |
@@ -11,25 +12,24 @@
|
| |
|
| |
Ruby 2.7 comes with several new features and performance improvements.
|
| |
|
| |
- ==== New features:
|
| |
+ ==== New features
|
| |
|
| |
* <<Pattern,Pattern Matching>>
|
| |
* <<REPL,REPL improvement>>
|
| |
* <<GC,Compaction GC>>
|
| |
* <<Separation,Separation of positional and keyword arguments>>
|
| |
|
| |
- ==== Performance improvements:
|
| |
+ ==== Performance improvements
|
| |
|
| |
* JIT [Experimental]
|
| |
* Fiber’s cache strategy is changed and fiber creation is speeded up.
|
| |
- * `Module#name`, `true.to_s`, `false.to_s`, and `nil.to_s` now always return a frozen String. The returned String is always the same for a given object. [Experimental]
|
| |
+ * `Module#name`, `true.to_s`, `false.to_s`, and `nil.to_s` now always return a frozen String. The returned String is always the same for a given object. [Experimental]
|
| |
* The performance of `Monitor` and `MonitorMixin` is improved.
|
| |
- * The performance of `CGI.escapeHTML` is improved.
|
| |
+ * The performance of `CGI.escapeHTML` is improved.
|
| |
* `Per-call-site` method cache, which has been there since around 1.9, was improved: cache hit rate raised from 89% to 94%.
|
| |
- * `RubyVM::InstructionSequence#to_binary` method generates compiled binary. The binary size is reduced.
|
| |
-
|
| |
- ==== Other notable changes:
|
| |
+ * `RubyVM::InstructionSequence#to_binary` method generates compiled binary. The binary size is reduced.
|
| |
|
| |
+ ==== Other notable changes
|
| |
|
| |
* Some standard libraries are updated.
|
| |
** Bundler 2.1.2
|
| |
@@ -37,7 +37,7 @@
|
| |
** Racc 1.4.15
|
| |
** CSV 3.1.2
|
| |
** REXML 3.2.3
|
| |
- ** RSS 0.2.8
|
| |
+ ** RSS 0.2.8
|
| |
** StringScanner 1.0.3
|
| |
** Some other libraries that have no original version are also updated.
|
| |
* The following libraries are no longer bundled gems. Install corresponding gems to use these features.
|
| |
@@ -67,28 +67,18 @@
|
| |
*** tracer
|
| |
*** uri
|
| |
*** yaml
|
| |
-
|
| |
* `Proc.new` and `proc` with no block in a method called with a block is warned now.
|
| |
-
|
| |
* lambda with no block in a method called with a block raises an exception.
|
| |
-
|
| |
- * Update Unicode version and Emoji version from 11.0.0 to 12.0.0.
|
| |
-
|
| |
- * Update Unicode version to 12.1.0, adding support for U+32FF SQUARE ERA NAME REIWA.
|
| |
-
|
| |
- * `Date.jisx0301`, `Date#jisx0301`, and `Date.parse` support the new Japanese era.
|
| |
-
|
| |
+ * Update Unicode version and Emoji version from 11.0.0 to 12.0.0.
|
| |
+ * Update Unicode version to 12.1.0, adding support for U+32FF SQUARE ERA NAME REIWA.
|
| |
+ * `Date.jisx0301`, `Date#jisx0301`, and `Date.parse` support the new Japanese era.
|
| |
* Require compilers to support C99.
|
| |
|
| |
-
|
| |
- === Detailed changes:
|
| |
-
|
| |
+ === Detailed changes
|
| |
|
| |
[[Pattern]]
|
| |
==== Pattern Matching [Experimental]
|
| |
|
| |
-
|
| |
-
|
| |
Pattern matching, a widely used feature in functional programming languages, is introduced as an experimental feature. It can traverse a given object and assign it's value if it matches a pattern.
|
| |
|
| |
[source,json]
|
| |
@@ -109,37 +99,32 @@
|
| |
end
|
| |
----
|
| |
|
| |
-
|
| |
[[REPL]]
|
| |
==== REPL improvement
|
| |
|
| |
-
|
| |
- `irb`, the bundled interactive environment (REPL; Read-Eval-Print-Loop), now supports multi-line editing. It is powered by `reline`, a `readline` -compatible library implemented in pure Ruby. It also provides rdoc integration. In `irb` you can display the reference for a given class, module, or method.
|
| |
-
|
| |
+ `irb`, the bundled interactive environment (REPL; Read-Eval-Print-Loop), now supports multi-line editing.
|
| |
+ It is powered by `reline`, a `readline` -compatible library implemented in pure Ruby.
|
| |
+ It also provides rdoc integration. In `irb` you can display the reference for a given class, module, or method.
|
| |
|
| |
[[GC]]
|
| |
==== Compaction GC
|
| |
|
| |
-
|
| |
This release introduces Compaction GC which can defragment a fragmented memory space.
|
| |
|
| |
Some multi-threaded Ruby programs may cause memory fragmentation, leading to high memory usage and degraded speed.
|
| |
|
| |
- The `GC.compact` method is introduced for compacting the heap. This function compacts live objects in the heap so that fewer pages may be used, and the heap may be more CoW (copy-on-write) friendly.
|
| |
-
|
| |
-
|
| |
+ The `GC.compact` method is introduced for compacting the heap.
|
| |
+ This function compacts live objects in the heap so that fewer pages may be used, and the heap may be more CoW (copy-on-write) friendly.
|
| |
|
| |
[[Separation]]
|
| |
==== Separation of positional and keyword arguments
|
| |
|
| |
+ Automatic conversion of keyword arguments and positional arguments is deprecated, and conversion will be removed in Ruby 3.
|
| |
|
| |
- Automatic conversion of keyword arguments and positional arguments is deprecated, and conversion will be removed in Ruby 3.
|
| |
-
|
| |
- ===== Changes:
|
| |
+ ===== Changes
|
| |
|
| |
-
|
| |
-
|
| |
- * When a method call passes a Hash at the last argument, and when it passes no keywords, and when the called method accepts keywords, a warning is emitted. To continue treating the hash as keywords, add a double splat operator to avoid the warning and ensure correct behavior in Ruby 3.
|
| |
+ * When a method call passes a Hash at the last argument, and when it passes no keywords, and when the called method accepts keywords, a warning is emitted.
|
| |
+ To continue treating the hash as keywords, add a double splat operator to avoid the warning and ensure correct behavior in Ruby 3.
|
| |
+
|
| |
[source,ruby]
|
| |
----
|
| |
@@ -149,7 +134,8 @@
|
| |
def foo(**kw); end; foo(**{key: 42}) # OK
|
| |
----
|
| |
|
| |
- * When a method call passes keywords to a method that accepts keywords, but it does not pass enough required positional arguments, the keywords are treated as a final required positional argument, and a warning is emitted. Pass the argument as a hash instead of keywords to avoid the warning and ensure correct behavior in Ruby 3.
|
| |
+ * When a method call passes keywords to a method that accepts keywords, but it does not pass enough required positional arguments, the keywords are treated as a final required positional argument, and a warning is emitted.
|
| |
+ Pass the argument as a hash instead of keywords to avoid the warning and ensure correct behavior in Ruby 3.
|
| |
+
|
| |
[source,ruby]
|
| |
----
|
| |
@@ -159,7 +145,8 @@
|
| |
def foo(h, key: 42); end; foo({key: 42}) # OK
|
| |
----
|
| |
|
| |
- * When a method accepts specific keywords but not a keyword splat, and a hash or keywords splat is passed to the method that includes both Symbol and non-Symbol keys, the hash will continue to be split, and a warning will be emitted. You will need to update the calling code to pass separate hashes to ensure correct behavior in Ruby 3.
|
| |
+ * When a method accepts specific keywords but not a keyword splat, and a hash or keywords splat is passed to the method that includes both Symbol and non-Symbol keys, the hash will continue to be split, and a warning will be emitted.
|
| |
+ You will need to update the calling code to pass separate hashes to ensure correct behavior in Ruby 3.
|
| |
+
|
| |
[source,ruby]
|
| |
----
|
| |
@@ -168,7 +155,8 @@
|
| |
def foo(h={}, key: 42); end; foo({"key" => 43}, key: 42) # OK
|
| |
----
|
| |
|
| |
- * If a method does not accept keywords, and is called with keywords, the keywords are still treated as a positional hash, with no warning. This behavior will continue to work in Ruby 3.
|
| |
+ * If a method does not accept keywords, and is called with keywords, the keywords are still treated as a positional hash, with no warning.
|
| |
+ This behavior will continue to work in Ruby 3.
|
| |
+
|
| |
[source,ruby]
|
| |
----
|
| |
@@ -182,7 +170,8 @@
|
| |
def foo(**kw); p kw; end; foo("str" => 1) #=> {"str"=>1}
|
| |
----
|
| |
|
| |
- * `**nil` is allowed in method definitions to explicitly mark that the method accepts no keywords. Calling such a method with keywords will result in an `ArgumentError`.
|
| |
+ * `**nil` is allowed in method definitions to explicitly mark that the method accepts no keywords.
|
| |
+ Calling such a method with keywords will result in an `ArgumentError`.
|
| |
+
|
| |
[source,ruby]
|
| |
----
|
| |
@@ -193,7 +182,8 @@
|
| |
def foo(h, **nil); end; foo({"str" => 1}) # OK
|
| |
----
|
| |
|
| |
- * Passing an empty keyword splat to a method that does not accept keywords no longer passes an empty hash, unless the empty hash is necessary for a required parameter, in which case a warning will be emitted. Remove the double splat to continue passing a positional hash.
|
| |
+ * Passing an empty keyword splat to a method that does not accept keywords no longer passes an empty hash, unless the empty hash is necessary for a required parameter, in which case a warning will be emitted.
|
| |
+ Remove the double splat to continue passing a positional hash.
|
| |
+
|
| |
[source,ruby]
|
| |
----
|
| |
@@ -203,21 +193,16 @@
|
| |
h = {}; def foo(a) a end; foo(h) # {}
|
| |
----
|
| |
|
| |
- If you want to disable the deprecation warnings, please use a command-line argument -W:no-deprecated or add Warning[:deprecated] = false to your code.
|
| |
+ If you want to disable the deprecation warnings, please use a command-line argument `-W:no-deprecated` or add `Warning[:deprecated] = false` to your code.
|
| |
|
| |
See the link:https://www.ruby-lang.org/en/news/2019/12/25/ruby-2-7-0-released/[upstream release announcement] for more detailed information about this release.
|
| |
|
| |
+ == Jekyll 4.0
|
| |
|
| |
-
|
| |
- == Jekyll has been updated to version 4
|
| |
-
|
| |
- The *Jekyll* static page generator and its plug-ins have been updated to version 4.0.0.
|
| |
-
|
| |
- This version includes the following changes compared to version 3.8:
|
| |
+ The *Jekyll* static page generator and its plug-ins have been updated to version 4.0.0. This version includes the following changes compared to version 3.8:
|
| |
|
| |
* Significant performance improvements
|
| |
* Cleanups and bug fixes
|
| |
* Other minor changes incompatible with the previous release
|
| |
|
| |
For more information about *Jekyll* 4.0.0, see link:https://jekyllrb.com/news/2019/08/20/jekyll-4-0-0-released/[].
|
| |
-
|
| |
This should be Fedora 32, not RHEL 8, right?