From 3e4ce193432446c2a0610face701c2375ee8f0bd Mon Sep 17 00:00:00 2001 From: Fumiya Shibusawa Date: Tue, 7 Jan 2020 15:27:45 +0900 Subject: [PATCH 0001/1090] feat: add ja translation for community guideline page --- ja/conduct/index.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 ja/conduct/index.md diff --git a/ja/conduct/index.md b/ja/conduct/index.md new file mode 100644 index 0000000000..05de7bfc5b --- /dev/null +++ b/ja/conduct/index.md @@ -0,0 +1,15 @@ +--- +layout: page +title: "Rubyコミュニティの行動規範ガイドライン" +lang: ja +--- + +Ruby開発者のコミュニティにおける安全かつ生産的なコラボレーションのため、以下の行動規範ガイドラインを用意しています。なお、これらはPostgreSQLの行動規範のドラフトを参考にしています。Rubyに関係するコミュニティ(カンファレンスなど)などで行動規範をつくる際にここから目的に沿うものを取っていただいて構いません。 +{: .summary} + +このドキュメントは、Rubyコミュニティに貢献したいと思うすべての人々にとって安全で生産的かつ協力的で互いに敬意を払える場所を提供するためのものです。コミュニティでコミュニケーションをする場(メーリングリスト、パッチの提出、commitのコメントなど)などすべてで適用されます。 + + * 参加者は、自身とは異なる意見、考えにも寛容な態度を示します。 + * 参加者は個人に対する攻撃や誹謗中傷などを示す発言・行動がないことを保証します。 + * 他の参加者の言葉や行動を解釈する際、それらが常に善意に基づくものだという前提に立ちます。 + * 合理的に考えてそれがハラスメントだとみなされる振る舞いは許容しません。 From 8ae349b56f7387677ab8b9c5183bebf4d02ea2cd Mon Sep 17 00:00:00 2001 From: hachi8833 Date: Wed, 22 Jan 2020 12:35:17 +0900 Subject: [PATCH 0002/1090] Add en doc --- ...ional-and-keyword-arguments-in-ruby-3-0.md | 355 ++++++++++++++++++ 1 file changed, 355 insertions(+) create mode 100644 ja/news/_posts/2019-12-12-separation-of-positional-and-keyword-arguments-in-ruby-3-0.md diff --git a/ja/news/_posts/2019-12-12-separation-of-positional-and-keyword-arguments-in-ruby-3-0.md b/ja/news/_posts/2019-12-12-separation-of-positional-and-keyword-arguments-in-ruby-3-0.md new file mode 100644 index 0000000000..44cd874cc1 --- /dev/null +++ b/ja/news/_posts/2019-12-12-separation-of-positional-and-keyword-arguments-in-ruby-3-0.md @@ -0,0 +1,355 @@ +--- +layout: news_post +title: "Separation of positional and keyword arguments in Ruby 3.0" +author: "mame" +translator: +date: 2019-12-12 12:00:00 +0000 +lang: en +--- + +This article explains the planned incompatibility of keyword arguments in Ruby 3.0 + +## tl;dr + +In Ruby 3.0, positional arguments and keyword arguments will be separated. Ruby 2.7 will warn for behaviors that will change in Ruby 3.0. If you see the following warnings, you need to update your code: + +* `Using the last argument as keyword parameters is deprecated`, or +* `Passing the keyword argument as the last hash parameter is deprecated`, or +* `Splitting the last argument into positional and keyword parameters is deprecated` + +In most cases, you can avoid the incompatibility by adding the _double splat_ operator. It explicitly specifies passing keyword arguments instead of a `Hash` object. Likewise, you may add braces `{}` to explicitly pass a `Hash` object, instead of keyword arguments. Read the section "Typical cases" below for more details. + +In Ruby 3, a method delegating all arguments must explicitly delegate keyword arguments in addition to positional arguments. If you want to keep the delegation behavior found in Ruby 2.7 and earlier, use `ruby2_keywords`. See the "Handling argument delegation" section below for more details. + +## Typical cases + +Here is the most typical case. You can use double splat operator (`**`) to pass keywords instead of a Hash. + +{% highlight ruby %} +# This method accepts only a keyword argument +def foo(k: 1) + p k +end + +h = { k: 42 } + +# This method call passes a positional Hash argument +# In Ruby 2.7: The Hash is automatically converted to a keyword argument +# In Ruby 3.0: This call raises an ArgumentError +foo(h) + # => demo.rb:11: warning: Using the last argument as keyword parameters is deprecated; maybe ** should be added to the call + # demo.rb:2: warning: The called method `foo' is defined here + # 42 + +# If you want to keep the behavior in Ruby 3.0, use double splat +foo(**h) #=> 42 +{% endhighlight %} + +Here is another case. You can use braces (`{}`) to pass a Hash instead of keywords explicitly. + +{% highlight ruby %} +# This method accepts one positional argument and a keyword rest argument +def bar(h, **kwargs) + p h +end + +# This call passes only a keyword argument and no positional arguments +# In Ruby 2.7: The keyword is converted to a positional Hash argument +# In Ruby 3.0: This call raises an ArgumentError +bar(k: 42) + # => demo2.rb:9: warning: Passing the keyword argument as the last hash parameter is deprecated + # demo2.rb:2: warning: The called method `bar' is defined here + # {:k=>42} + +# If you want to keep the behavior in Ruby 3.0, write braces to make it an +# explicit Hash +bar({ k: 42 }) # => {:k=>42} +{% endhighlight %} + +## What is deprecated? + +In Ruby 2, keyword arguments can be treated as the last positional Hash argument and a last positional Hash argument can be treated as keyword arguments. + +Because the automatic conversion is sometimes too complex and troublesome as described in the final section. So it's now deprecated in Ruby 2.7 and will be removed in Ruby 3. In other words, keyword arguments will be completely separated from positional one in Ruby 3. So when you want to pass keyword arguments, you should always use `foo(k: expr)` or `foo(**expr)`. If you want to accept keyword arguments, in principle you should always use `def foo(k: default)` or `def foo(k:)` or `def foo(**kwargs)`. + +Note that Ruby 3.0 doesn't behave differently when calling a method which doesn't accept keyword arguments with keyword arguments. For instance, the following case is not going to be deprecated and will keep working in Ruby 3.0. The keyword arguments are still treated as a positional Hash argument. + +{% highlight ruby %} +def foo(kwargs = {}) + kwargs +end + +foo(k: 1) #=> {:k=>1} +{% endhighlight %} + +This is because this style is used very frequently, and there is no ambiguity in how the argument should be treated. Prohibiting this conversion would result in additional incompatibility for little benefit. + +However, this style is not recommended in new code, unless you are often passing a Hash as a positional argument, and are also using keyword arguments. Otherwise, use double splat: + +{% highlight ruby %} +def foo(**kwargs) + kwargs +end + +foo(k: 1) #=> {:k=>1} +{% endhighlight %} + +## Will my code break on Ruby 2.7? + +A short answer is "maybe not". + +The changes in Ruby 2.7 are designed as a migration path towards 3.0. While in principle, Ruby 2.7 only warns against behaviors that will change in Ruby 3, it includes some incompatible changes we consider to be minor. See the "Other minor changes" section for details. + +Except for the warnings and minor changes, Ruby 2.7 attempts to keep the compatibility with Ruby 2.6. So, your code will probably work on Ruby 2.7, though it may emit warnings. And by running it on Ruby 2.7, you can check if your code is ready for Ruby 3.0. + +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. + +## Handling argument delegation + +### Ruby 2.6 or prior + +In Ruby 2, you can write a delegation method by accepting a `*rest` argument and a `&block` argument, and passing the two to the target method. In this behavior, the keyword arguments are also implicitly handled by the automatic conversion between positional and keyword arguments. + +{% highlight ruby %} +def foo(*args, &block) + target(*args, &block) +end +{% endhighlight %} + +### Ruby 3 + +You need to explicitly delegate keyword arguments. + +{% highlight ruby %} +def foo(*args, **kwargs, &block) + target(*args, **kwargs, &block) +end +{% endhighlight %} + +Alternatively, if you do not need compatibility with Ruby 2.6 or prior and you don't alter any arguments, you can use the new delegation syntax (`...`) that is introduced in Ruby 2.7. + +{% highlight ruby %} +def foo(...) + target(...) +end +{% endhighlight %} + +### Ruby 2.7 + +In short: use `Module#ruby2_keywords` and delegate `*args, &block`. + +{% highlight ruby %} +ruby2_keywords def foo(*args, &block) + target(*args, &block) +end +{% endhighlight %} + +`ruby2_keywords` accepts keyword arguments as the last Hash argument, and passes it as keyword arguments when calling the other method. + +In fact, Ruby 2.7 allows the new style of delegation in many cases. However, there is a known corner case. See the next section. + +### A compatible delegation that works on Ruby 2.6, 2.7 and Ruby 3 + +In short: use `Module#ruby2_keywords` again. + +{% highlight ruby %} +ruby2_keywords def foo(*args, &block) + target(*args, &block) +end +{% endhighlight %} + +Unfortunately, we need to use the old-style delegation (i.e., no `**kwargs`) because Ruby 2.6 or prior does not handle the new delegation style correctly. This is one of the reasons of the keyword argument separation; the details are described in the final section. And `ruby2_keywords` allows you to run the old style even in Ruby 2.7 and 3.0. As there is no `ruby2_keywords` defined in 2.6 or prior, please use the [ruby2_keywords gem](https://rubygems.org/gems/ruby2_keywords) or define it yourself: + +{% highlight ruby %} +def ruby2_keywords(*) +end if RUBY_VERSION < "2.7" +{% endhighlight %} + +--- + +If your code doesn't have to run on Ruby 2.6 or older, you may try the new style in Ruby 2.7. In almost all cases, it works. Note that, however, there are unfortunate corner cases as follows: + +{% highlight ruby %} +def target(*args) + p args +end + +def foo(*args, **kwargs, &block) + target(*args, **kwargs, &block) +end + +foo({}) #=> Ruby 2.7: [] ({} is dropped) +foo({}, **{}) #=> Ruby 2.7: [{}] (You can pass {} by explicitly passing "no" keywords) +{% endhighlight %} + +An empty Hash argument is automatically converted and absorbed into `**kwargs`, and the delegation call removes the empty keyword hash, so no argument is passed to `target`. As far as we know, this is the only corner case. + +As noted in the last line, you can work around this issue by using `**{}`. + +If you really worry about the portability, use `ruby2_keywords`. (Acknowledge that Ruby 2.6 or before themselves have tons of corner cases in keyword arguments. :-) +`ruby2_keywords` might be removed in the future after Ruby 2.6 reaches end-of-life. At that point, we recommend to explicitly delegate keyword arguments (see Ruby 3 code above). + +## Other minor changes + +There are three minor changes about keyword arguments in Ruby 2.7. + +### 1. Non-Symbol keys are allowed in keyword arguments + +In Ruby 2.6 or before, only Symbol keys were allowed in keyword arguments. In Ruby 2.7, keyword arguments can use non-Symbol keys. + +{% highlight ruby %} +def foo(**kwargs) + kwargs +end +foo("key" => 42) + #=> Ruby 2.6 or before: ArgumentError: wrong number of arguments + #=> Ruby 2.7 or later: {"key"=>42} +{% endhighlight %} + +If a method accepts both optional and keyword arguments, the Hash object that has both Symbol keys and non-Symbol keys was split in two in Ruby 2.6. In Ruby 2.7, both are accepted as keywords because non-Symbol keys are allowed. + +{% highlight ruby %} +def bar(x=1, **kwargs) + p [x, kwargs] +end + +bar("key" => 42, :sym => 43) + #=> Ruby 2.6: [{"key"=>42}, {:sym=>43}] + #=> Ruby 2.7: [1, {"key"=>42, :sym=>43}] + +# Use braces to keep the behavior +bar({"key" => 42}, :sym => 43) + #=> Ruby 2.6 and 2.7: [{"key"=>42}, {:sym=>43}] +{% endhighlight %} + +Ruby 2.7 still splits hashes with a warning if passing a Hash or keyword arguments with both Symbol and non-Symbol keys to a method that accepts explicit keywords but no keyword rest argument (`**kwargs`). This behavior will be removed in Ruby 3, and an `ArgumentError` will be raised. + +{% highlight ruby %} +def bar(x=1, sym: nil) + p [x, sym] +end + +bar("key" => 42, :sym => 43) +# Ruby 2.6 and 2.7: => [{"key"=>42}, 43] +# Ruby 2.7: warning: Splitting the last argument into positional and keyword parameters is deprecated +# warning: The called method `bar' is defined here +# Ruby 3.0: ArgumentError +{% endhighlight %} + +### 2. Double splat with an empty hash (`**{}`) passes no arguments + +In Ruby 2.6 or before, passing `**empty_hash` passes an empty Hash as a positional argument. In Ruby 2.7 or later, it passes no arguments. + +{% highlight ruby %} +def foo(*args) + args +end + +empty_hash = {} +foo(**empty_hash) + #=> Ruby 2.6 or before: [{}] + #=> Ruby 2.7 or later: [] +{% endhighlight %} + +Note that `foo(**{})` passes nothing in both Ruby 2.6 and 2.7. In Ruby 2.6 and before, `**{}` is removed by the parser, and in Ruby 2.7 and above, it is treated the same as `**empty_hash`, allowing for an easy way to pass no keyword arguments to a method. + +In Ruby 2.7, when calling a method with an insufficient number of required positional arguments, `foo(**empty_hash)` passes an empty hash with a warning emitted, for compatibility with Ruby 2.6. This behavior will be removed in 3.0. + +{% highlight ruby %} +def foo(x) + x +end + +empty_hash = {} +foo(**empty_hash) + #=> Ruby 2.6 or before: {} + #=> Ruby 2.7: warning: Passing the keyword argument as the last hash parameter is deprecated + # warning: The called method `foo' is defined here + #=> Ruby 3.0: ArgumentError: wrong number of arguments +{% endhighlight %} + +### 3. The no-keyword-arguments syntax (`**nil`) is introduced + +You can use `**nil` in a method definition to explicitly mark the method accepts no keyword arguments. Calling such methods with keyword arguments will result in an `ArgumentError`. (This is actually a new feature, not an incompatibility) + +{% highlight ruby %} +def foo(*args, **nil) +end + +foo(k: 1) + #=> Ruby 2.7 or later: no keywords accepted (ArgumentError) +{% endhighlight %} + +This is useful to make it explicit that the method does not accept keyword arguments. Otherwise, the keywords are absorbed in the rest argument in the above example. If you extend a method to accept keyword arguments, the method may have incompatibility as follows: + +{% highlight ruby %} +# If a method accepts rest argument and no `**nil` +def foo(*args) + p args +end + +# Passing keywords are converted to a Hash object (even in Ruby 3.0) +foo(k: 1) #=> [{:k=>1}] + +# If the method is extended to accept a keyword +def foo(*args, mode: false) + p args +end + +# The existing call may break +foo(k: 1) #=> ArgumentError: unknown keyword k +{% endhighlight %} + +## Why we're deprecating the automatic conversion + +The automatic conversion initially appeared to be a good idea, and worked well in many cases. However, it had too many corner cases, and we have received many bug reports about the behavior. + +Automatic conversion does not work well when a method accepts optional positional arguments and keyword arguments. Some people expect the last Hash object to be treated as a positional argument, and others expect it to be converted to keyword arguments. + +Here is one of the most confusing cases: + +{% highlight ruby %} +def foo(x, **kwargs) + p [x, kwargs] +end + +def bar(x=1, **kwargs) + p [x, kwargs] +end + +foo({}) => [{}, {}] +bar({}) => [1, {}] + +bar({}, **{}) => expected: [{}, {}], actual: [1, {}] +{% endhighlight %} + +In Ruby 2, `foo({})` passes an empty hash as a normal argument (i.e., `{}` is assigned to `x`), while `bar({})` passes a keyword argument (i.e, `{}` is assigned to `kwargs`). So `any_method({})` is very ambiguous. + +You may think of `bar({}, **{})` to pass the empty hash to `x` explicitly. Surprisingly, it does not work as you expected; it still prints `[1, {}]` in Ruby 2.6. This is because `**{}` is ignored by the parser in Ruby 2.6, and the first argument `{}` is automatically converted to keywords (`**kwargs`). In this case, you need to call `bar({}, {})`, which is very weird. + +The same issues also apply to methods that accept rest and keyword arguments. This makes explicit delegation of keyword arguments not work. + +{% highlight ruby %} +def target(*args) + p args +end + +def foo(*args, **kwargs, &block) + target(*args, **kwargs, &block) +end + +foo() #=> Ruby 2.6 or before: [{}] + #=> Ruby 2.7 or later: [] +{% endhighlight %} + +`foo()` passes no arguments, but `target` receives an empty hash argument in Ruby 2.6. This is because the method `foo` delegates keywords (`**kwargs`) explicitly. When `foo()` is called, `args` is an empty Array, `kwargs` is an empty Hash, and `block` is `nil`. And then `target(*args, **kwargs, &block)` passes an empty Hash as an argument because `**kwargs` is automatically converted to a positional Hash argument. + +The automatic conversion not only confuses people but also makes the method less extensible. See [[Feature #14183]](https://bugs.ruby-lang.org/issues/14183) for more details about the reasons for the change in behavior, and why certain implementation choices were made. + +## Acknowledgment + +This article was kindly reviewed (or even co-authored) by Jeremy Evans and Benoit Daloze. + +## History + +* Updated 2019-12-25: In 2.7.0-rc2, the warning message was slightly changed, and an API to suppress the warnings was added. From a883bdda941814ffb08f6c1156453f8859655863 Mon Sep 17 00:00:00 2001 From: hachi8833 Date: Wed, 22 Jan 2020 12:35:47 +0900 Subject: [PATCH 0003/1090] Translate "Separation of positional and keyword arguments in Ruby 3.0" --- ...ional-and-keyword-arguments-in-ruby-3-0.md | 195 +++++++++--------- 1 file changed, 99 insertions(+), 96 deletions(-) diff --git a/ja/news/_posts/2019-12-12-separation-of-positional-and-keyword-arguments-in-ruby-3-0.md b/ja/news/_posts/2019-12-12-separation-of-positional-and-keyword-arguments-in-ruby-3-0.md index 44cd874cc1..5e80e231d5 100644 --- a/ja/news/_posts/2019-12-12-separation-of-positional-and-keyword-arguments-in-ruby-3-0.md +++ b/ja/news/_posts/2019-12-12-separation-of-positional-and-keyword-arguments-in-ruby-3-0.md @@ -2,77 +2,81 @@ layout: news_post title: "Separation of positional and keyword arguments in Ruby 3.0" author: "mame" -translator: +translator: "hachi8833" date: 2019-12-12 12:00:00 +0000 -lang: en +lang: ja --- -This article explains the planned incompatibility of keyword arguments in Ruby 3.0 +本記事では、Ruby 3.0で予定されているキーワード引数の非互換性について解説します。 -## tl;dr +## 概要 -In Ruby 3.0, positional arguments and keyword arguments will be separated. Ruby 2.7 will warn for behaviors that will change in Ruby 3.0. If you see the following warnings, you need to update your code: +Ruby 3.0では、位置引数とキーワード引数が分離されます。Ruby 3.0で変更される振る舞いはRuby 2.7でwarningを表示します。以下のいずれかのwarningが表示される場合は、コードのアップデートが必要です。 * `Using the last argument as keyword parameters is deprecated`, or * `Passing the keyword argument as the last hash parameter is deprecated`, or * `Splitting the last argument into positional and keyword parameters is deprecated` -In most cases, you can avoid the incompatibility by adding the _double splat_ operator. It explicitly specifies passing keyword arguments instead of a `Hash` object. Likewise, you may add braces `{}` to explicitly pass a `Hash` object, instead of keyword arguments. Read the section "Typical cases" below for more details. +この非互換性は、double splat演算子(`**`)を追加することでほぼ回避できます。これにより、`Hash`オブジェクトではなくキーワード引数を渡すことが明示的に指定されます。同様に、キーワード引数ではなく`Hash`オブジェクトを明示的に渡したい場合は中かっこ(`{}`)を追加できます。詳しくは後述の「典型的なケース」をご覧ください。 -In Ruby 3, a method delegating all arguments must explicitly delegate keyword arguments in addition to positional arguments. If you want to keep the delegation behavior found in Ruby 2.7 and earlier, use `ruby2_keywords`. See the "Handling argument delegation" section below for more details. +Ruby 3では、すべての引数を委譲するメソッドで、位置引数の他に必ずキーワード引数も明示的に委譲しなければなりません。Ruby 2.7以前の委譲の振る舞いを変えたくない場合は、`ruby2_keywords`をお使いください。詳しくは後述の「引数の委譲の扱いについて」をご覧ください。 -## Typical cases +## よくあるケース -Here is the most typical case. You can use double splat operator (`**`) to pass keywords instead of a Hash. +以下はもっともよくあるケースです。Hashではなくキーワードを渡すのにdouble splat演算子(`**`)を使えます。 {% highlight ruby %} -# This method accepts only a keyword argument +# このメソッドはキーワード引数のみを受け取る def foo(k: 1) p k end h = { k: 42 } -# This method call passes a positional Hash argument -# In Ruby 2.7: The Hash is automatically converted to a keyword argument -# In Ruby 3.0: This call raises an ArgumentError +# このメソッド呼び出しは位置引数としてHashを渡している +# Ruby 2.7: このHashは自動でキーワード引数に変換される +# Ruby 3.0: この呼び出しはArgumentErrorになる foo(h) # => demo.rb:11: warning: Using the last argument as keyword parameters is deprecated; maybe ** should be added to the call # demo.rb:2: warning: The called method `foo' is defined here # 42 -# If you want to keep the behavior in Ruby 3.0, use double splat +# この振る舞いをRuby 3.0で変えたくない場合はdouble splatを用いる foo(**h) #=> 42 {% endhighlight %} -Here is another case. You can use braces (`{}`) to pass a Hash instead of keywords explicitly. +別の例: キーワード引数ではなくHashを明示的に渡す場合は中かっこ(`{}`)を使います。 {% highlight ruby %} -# This method accepts one positional argument and a keyword rest argument +# このメソッドは位置引数を1個、残りはキーワード引数を受け取る def bar(h, **kwargs) p h end -# This call passes only a keyword argument and no positional arguments -# In Ruby 2.7: The keyword is converted to a positional Hash argument -# In Ruby 3.0: This call raises an ArgumentError +# この呼び出しではキーワード引数のみが渡され、位置引数は渡されない +# Ruby 2.7: このキーワード引数は自動でHash引数に変換される +# Ruby 3.0: この呼び出しはArgumentErrorになる bar(k: 42) # => demo2.rb:9: warning: Passing the keyword argument as the last hash parameter is deprecated # demo2.rb:2: warning: The called method `bar' is defined here # {:k=>42} -# If you want to keep the behavior in Ruby 3.0, write braces to make it an -# explicit Hash +# この振る舞いをRuby 3.0で変えたくない場合は +# 中かっこで明示的にHashにする bar({ k: 42 }) # => {:k=>42} {% endhighlight %} -## What is deprecated? +## どの動作が非推奨になるか -In Ruby 2, keyword arguments can be treated as the last positional Hash argument and a last positional Hash argument can be treated as keyword arguments. +Ruby 2では、キーワード引数が末尾のハッシュ位置引数として扱われることがあります。また、末尾のハッシュ引数がキーワード引数として扱われることもあります。 -Because the automatic conversion is sometimes too complex and troublesome as described in the final section. So it's now deprecated in Ruby 2.7 and will be removed in Ruby 3. In other words, keyword arguments will be completely separated from positional one in Ruby 3. So when you want to pass keyword arguments, you should always use `foo(k: expr)` or `foo(**expr)`. If you want to accept keyword arguments, in principle you should always use `def foo(k: default)` or `def foo(k:)` or `def foo(**kwargs)`. +この自動変換は場合によっては複雑になりすぎてしまい、本記事末尾で後述するようにトラブルの原因になることがあります。そのため、この自動変換をRuby 2.7で非推奨とし、Ruby 3.0で廃止する予定です。言い換えると、Ruby 3.0のキーワード引数は位置引数と完全に分離されることになります。つまり、キーワード引数を渡したい場合は、常に`foo(k: expr)`または`foo(**expr)`の形にすべきです。(メソッド定義で)キーワード引数を受け取りたい場合は、原則として常に以下のいずれかの形にすべきです。 -Note that Ruby 3.0 doesn't behave differently when calling a method which doesn't accept keyword arguments with keyword arguments. For instance, the following case is not going to be deprecated and will keep working in Ruby 3.0. The keyword arguments are still treated as a positional Hash argument. +* `def foo(k: default)` +* `def foo(k:)` +* `def foo(**kwargs)` + +なお、キーワード引数を受け取らないメソッドを呼び出すときにキーワード引数を渡した場合の振る舞いは、Ruby 3.0でも変わらない点にご注意ください。たとえば、以下のケースは非推奨にはならず、Ruby 3.0でも引き続き動作します(このキーワード引数は引き続きHash位置引数として扱われます)。 {% highlight ruby %} def foo(kwargs = {}) @@ -82,9 +86,9 @@ end foo(k: 1) #=> {:k=>1} {% endhighlight %} -This is because this style is used very frequently, and there is no ambiguity in how the argument should be treated. Prohibiting this conversion would result in additional incompatibility for little benefit. +変わらない理由は、このスタイルが非常によく用いられていることと、この呼び出し方法では引数の扱いに曖昧な点がないためです。この振る舞いまで禁止してしまうと、得られるメリットが少ないうえに非互換性がさらに増えてしまいます。 -However, this style is not recommended in new code, unless you are often passing a Hash as a positional argument, and are also using keyword arguments. Otherwise, use double splat: +ただし今後新しいコードを書く場合、このスタイルはおすすめできません(Hashを位置引数として渡す頻度が高く、かつキーワード引数も使う場合を除く)。代わりに、次のようにdouble splat(`**`)をお使いください。 {% highlight ruby %} def foo(**kwargs) @@ -94,21 +98,21 @@ end foo(k: 1) #=> {:k=>1} {% endhighlight %} -## Will my code break on Ruby 2.7? +## Q: 自分のコードはRuby 2.7で動かなくなりますか? -A short answer is "maybe not". +手短かに言うと「壊れない可能性はあります」。 -The changes in Ruby 2.7 are designed as a migration path towards 3.0. While in principle, Ruby 2.7 only warns against behaviors that will change in Ruby 3, it includes some incompatible changes we consider to be minor. See the "Other minor changes" section for details. +Ruby 2.7におけるこの変更は、3.0への移行パスとして設計されています。あくまで原則としてですが、Ruby 2.7ではRuby 3.0で変更される振る舞いについてwarningを出すにとどめており、warningの中には私たちが微細とみなしている変更点も若干含まれます。詳しくは後述の「その他の微細な変更点」をご覧ください。 -Except for the warnings and minor changes, Ruby 2.7 attempts to keep the compatibility with Ruby 2.6. So, your code will probably work on Ruby 2.7, though it may emit warnings. And by running it on Ruby 2.7, you can check if your code is ready for Ruby 3.0. +Ruby 2.7では、warningが表示される点と微細な変更点以外を除いてRuby 2.6との互換性を保とうとしています。つまり、あなたのコードはRuby 2.7でもおそらく動作しますが、warningが表示される可能性はあります。あなたのコードをRuby 2.7で実行すれば、Ruby 3.0の準備ができているかどうかをチェックできます。 -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. +非推奨のwarningを無効にしたい場合は、コマンドライン引数`-W:no-deprecated`を使うか、コードに`Warning[:deprecated] = false`を追加します。 -## Handling argument delegation +## 引数の委譲の扱いについて -### Ruby 2.6 or prior +### Ruby 2.6以前の場合 -In Ruby 2, you can write a delegation method by accepting a `*rest` argument and a `&block` argument, and passing the two to the target method. In this behavior, the keyword arguments are also implicitly handled by the automatic conversion between positional and keyword arguments. +Ruby 2では、以下のように1個の`*rest`引数と1個の`&block`引数を受け付けて、この2つの引数を委譲先メソッド(以下の`target`)に渡すことで委譲メソッドを書けます。この振る舞いでは、(1つ以上の)キーワード引数も「位置引数<=>キーワード引数の自動変換」によって暗黙的に扱われます。 {% highlight ruby %} def foo(*args, &block) @@ -116,9 +120,9 @@ def foo(*args, &block) end {% endhighlight %} -### Ruby 3 +### Ruby 3の場合 -You need to explicitly delegate keyword arguments. +以下のようにキーワード引数を明示的に委譲する必要があります。 {% highlight ruby %} def foo(*args, **kwargs, &block) @@ -126,7 +130,7 @@ def foo(*args, **kwargs, &block) end {% endhighlight %} -Alternatively, if you do not need compatibility with Ruby 2.6 or prior and you don't alter any arguments, you can use the new delegation syntax (`...`) that is introduced in Ruby 2.7. +別の方法として、Ruby 2.6以前との互換性を考慮する必要がなく、かつ引数を一切改変しないのであれば、以下のようにRuby 2.7で新しく導入される委譲構文(`...`)を利用できます。 {% highlight ruby %} def foo(...) @@ -134,9 +138,9 @@ def foo(...) end {% endhighlight %} -### Ruby 2.7 +### Ruby 2.7の場合 -In short: use `Module#ruby2_keywords` and delegate `*args, &block`. +手短かに言うと、以下のように`Module#ruby2_keywords`を用い、`*args, &block`を委譲します。 {% highlight ruby %} ruby2_keywords def foo(*args, &block) @@ -144,13 +148,13 @@ ruby2_keywords def foo(*args, &block) end {% endhighlight %} -`ruby2_keywords` accepts keyword arguments as the last Hash argument, and passes it as keyword arguments when calling the other method. +`ruby2_keywords`を指定すると、キーワード引数を末尾のHash引数として受け取れるようになり、他のメソッドを呼び出すときにそれをキーワード引数として渡せます。 -In fact, Ruby 2.7 allows the new style of delegation in many cases. However, there is a known corner case. See the next section. +実際、Ruby 2.7では多くの場面でこの新しい委譲のスタイルを利用できます。ただし1つ既知のエッジケースがあります。次をご覧ください。 -### A compatible delegation that works on Ruby 2.6, 2.7 and Ruby 3 +### Ruby 2.6 / 2.7 / 3で互換性のある委譲スタイル -In short: use `Module#ruby2_keywords` again. +手短かに言うと、ここも「`Module#ruby2_keywords`を使う」となります。 {% highlight ruby %} ruby2_keywords def foo(*args, &block) @@ -158,16 +162,16 @@ ruby2_keywords def foo(*args, &block) end {% endhighlight %} -Unfortunately, we need to use the old-style delegation (i.e., no `**kwargs`) because Ruby 2.6 or prior does not handle the new delegation style correctly. This is one of the reasons of the keyword argument separation; the details are described in the final section. And `ruby2_keywords` allows you to run the old style even in Ruby 2.7 and 3.0. As there is no `ruby2_keywords` defined in 2.6 or prior, please use the [ruby2_keywords gem](https://rubygems.org/gems/ruby2_keywords) or define it yourself: +残念ながら、Ruby 2.6以前では新しい委譲スタイルを正しく扱えないため、旧来の委譲スタイル(`**kwargs`を使わないなど)を使う必要があります。これは、キーワード引数を分離した理由のひとつでもあります(詳しくは本記事末尾をご覧ください)。`ruby2_keywords`を用いれば、Ruby 2.7や3.0でも旧来の委譲スタイルを引き続き利用できます。2.6以前のRubyでは`ruby2_keywords`が定義されていないので、[ruby2_keywords](https://rubygems.org/gems/ruby2_keywords) gemを使うか、以下を手動で定義します。 {% highlight ruby %} def ruby2_keywords(*) end if RUBY_VERSION < "2.7" {% endhighlight %} ---- +* * * * * -If your code doesn't have to run on Ruby 2.6 or older, you may try the new style in Ruby 2.7. In almost all cases, it works. Note that, however, there are unfortunate corner cases as follows: +自分のコードがRuby 2.6以前で動かなくても構わないのであれば、Ruby 2.7で新しいスタイルを試してもよいでしょう。ほぼほぼ間違いなく動作しますが、以下のようなエッジケースを運悪く踏むこともあります。 {% highlight ruby %} def target(*args) @@ -178,35 +182,34 @@ def foo(*args, **kwargs, &block) target(*args, **kwargs, &block) end -foo({}) #=> Ruby 2.7: [] ({} is dropped) -foo({}, **{}) #=> Ruby 2.7: [{}] (You can pass {} by explicitly passing "no" keywords) +foo({}) #=> Ruby 2.7: [] ({}を含んでいない) +foo({}, **{}) #=> Ruby 2.7: [{}] ({}を渡せば、キーワード引数が「ない」ことを明示できる) {% endhighlight %} -An empty Hash argument is automatically converted and absorbed into `**kwargs`, and the delegation call removes the empty keyword hash, so no argument is passed to `target`. As far as we know, this is the only corner case. +上のコードでは、空のHash引数が自動的に変換されて`**kwargs`に吸い込まれ、この空のキーワードハッシュは委譲の呼び出しで削除されます。このため、`targe`には引数がまったく渡されなくなります。私たちが把握している範囲では、これが唯一のエッジケースです。 -As noted in the last line, you can work around this issue by using `**{}`. +上のコードの最下部に書いたように、`**{}`を渡すことでこの問題を回避できます。 -If you really worry about the portability, use `ruby2_keywords`. (Acknowledge that Ruby 2.6 or before themselves have tons of corner cases in keyword arguments. :-) -`ruby2_keywords` might be removed in the future after Ruby 2.6 reaches end-of-life. At that point, we recommend to explicitly delegate keyword arguments (see Ruby 3 code above). +移植性がどうしても不安な場合は`ruby2_keywords`をお使いください(Ruby 2.6以前ではキーワード引数周りで膨大なエッジケースが存在していることを知っておいてください)。`ruby2_keywords`は、今後Ruby 2.6が役目を終えたときに削除される可能性があります。現時点で私たちがおすすめできるのは、キーワード引数を明示的に委譲することです(上述のRuby 3向けのコードを参照)。 -## Other minor changes +## その他の微細な変更点 -There are three minor changes about keyword arguments in Ruby 2.7. +Ruby 2.7のキーワード引数では、この他に以下の3つのマイナーチェンジが行われています。 -### 1. Non-Symbol keys are allowed in keyword arguments +### 1\. キーワード引数で非シンボルキーを利用できるようになった -In Ruby 2.6 or before, only Symbol keys were allowed in keyword arguments. In Ruby 2.7, keyword arguments can use non-Symbol keys. +Ruby 2.6以前のキーワード引数では、シンボル形式のキーしか利用できませんでした。Ruby 2.7のキーワード引数では、以下のようにシンボル形式でないキーを利用できるようになります。 {% highlight ruby %} def foo(**kwargs) kwargs end foo("key" => 42) - #=> Ruby 2.6 or before: ArgumentError: wrong number of arguments - #=> Ruby 2.7 or later: {"key"=>42} + #=> Ruby 2.6以前: ArgumentError: wrong number of arguments + #=> Ruby 2.7以降: {"key"=>42} {% endhighlight %} -If a method accepts both optional and keyword arguments, the Hash object that has both Symbol keys and non-Symbol keys was split in two in Ruby 2.6. In Ruby 2.7, both are accepted as keywords because non-Symbol keys are allowed. +あるメソッドがオプション引数とキーワード引数を両方とも受け付ける場合、Ruby 2.6では以下のようにシンボル形式のキーと非シンボルキーを両方持つHashオブジェクトが2つに分割されていました。Ruby 2.7では非シンボルキーを利用できるので、どちらも受け取れます。 {% highlight ruby %} def bar(x=1, **kwargs) @@ -217,12 +220,12 @@ bar("key" => 42, :sym => 43) #=> Ruby 2.6: [{"key"=>42}, {:sym=>43}] #=> Ruby 2.7: [1, {"key"=>42, :sym=>43}] -# Use braces to keep the behavior +# 振る舞いを変えたくない場合は中かっこ{}を使う bar({"key" => 42}, :sym => 43) #=> Ruby 2.6 and 2.7: [{"key"=>42}, {:sym=>43}] {% endhighlight %} -Ruby 2.7 still splits hashes with a warning if passing a Hash or keyword arguments with both Symbol and non-Symbol keys to a method that accepts explicit keywords but no keyword rest argument (`**kwargs`). This behavior will be removed in Ruby 3, and an `ArgumentError` will be raised. +Ruby 2.7では、キーワード引数を明示的に受け付けるがキーワードrest引数(`**kwargs`)を受け取らないメソッドに対して、シンボル形式のキーと非シンボルキーが両方混じったHashやキーワード引数を渡すと、引き続きハッシュを分割して警告を表示します。この振る舞いはRuby 3で廃止されて`ArgumentError`にする予定です。 {% highlight ruby %} def bar(x=1, sym: nil) @@ -230,15 +233,15 @@ def bar(x=1, sym: nil) end bar("key" => 42, :sym => 43) -# Ruby 2.6 and 2.7: => [{"key"=>42}, 43] +# Ruby 2.6と2.7: => [{"key"=>42}, 43] # Ruby 2.7: warning: Splitting the last argument into positional and keyword parameters is deprecated # warning: The called method `bar' is defined here # Ruby 3.0: ArgumentError {% endhighlight %} -### 2. Double splat with an empty hash (`**{}`) passes no arguments +### 2\. double splatを付けた空ハッシュ(`**{}`)で引数を渡さないようになった -In Ruby 2.6 or before, passing `**empty_hash` passes an empty Hash as a positional argument. In Ruby 2.7 or later, it passes no arguments. +Ruby 2.6以前は、`**empty_hash`を渡すと位置引数に空のハッシュが渡されました(`[{}]`)。Ruby 2.7以降では引数を渡さなくなります。 {% highlight ruby %} def foo(*args) @@ -247,13 +250,13 @@ end empty_hash = {} foo(**empty_hash) - #=> Ruby 2.6 or before: [{}] - #=> Ruby 2.7 or later: [] + #=> Ruby 2.6以前: [{}] + #=> Ruby 2.7以降: [] {% endhighlight %} -Note that `foo(**{})` passes nothing in both Ruby 2.6 and 2.7. In Ruby 2.6 and before, `**{}` is removed by the parser, and in Ruby 2.7 and above, it is treated the same as `**empty_hash`, allowing for an easy way to pass no keyword arguments to a method. +なお、`foo(**{})`はRuby 2.6以前とRuby 2.7のどちらの場合も引数を渡さず、`**{}`がパーサーによって削除される点にご注意ください。また、Ruby 2.7以降ではどちらも`**empty_hash`として同じに扱われるので、メソッドにキーワード引数を渡さないようにする指定が楽に行なえます。 -In Ruby 2.7, when calling a method with an insufficient number of required positional arguments, `foo(**empty_hash)` passes an empty hash with a warning emitted, for compatibility with Ruby 2.6. This behavior will be removed in 3.0. +Ruby 2.7では、あるメソッド呼び出しで必須とされる位置引数の個数が不足している場合、Ruby 2.6との互換性を保つために`foo(**empty_hash)`は空のハッシュを渡してwarningを表示します。この振る舞いはRuby 3.0で廃止されます。 {% highlight ruby %} def foo(x) @@ -262,51 +265,51 @@ end empty_hash = {} foo(**empty_hash) - #=> Ruby 2.6 or before: {} + #=> Ruby 2.6以前: {} #=> Ruby 2.7: warning: Passing the keyword argument as the last hash parameter is deprecated # warning: The called method `foo' is defined here #=> Ruby 3.0: ArgumentError: wrong number of arguments {% endhighlight %} -### 3. The no-keyword-arguments syntax (`**nil`) is introduced +### 3\. キーワード引数を受け取らないことを表す構文(`**nil`)が導入される -You can use `**nil` in a method definition to explicitly mark the method accepts no keyword arguments. Calling such methods with keyword arguments will result in an `ArgumentError`. (This is actually a new feature, not an incompatibility) +メソッド定義で`**nil`を用いることで、そのメソッドがキーワード引数を受け取らないことを明示的に示せるようになります。このメソッドを呼び出すときにキーワード引数を渡すと`ArgumentError`が表示されます(これは非互換性ではなく、事実上新機能です)。 {% highlight ruby %} def foo(*args, **nil) end foo(k: 1) - #=> Ruby 2.7 or later: no keywords accepted (ArgumentError) + #=> Ruby 2.7以降: no keywords accepted (ArgumentError) {% endhighlight %} -This is useful to make it explicit that the method does not accept keyword arguments. Otherwise, the keywords are absorbed in the rest argument in the above example. If you extend a method to accept keyword arguments, the method may have incompatibility as follows: +この新構文は、メソッドがキーワード引数を受け取らないことを明示的に指定するのに有用です。これを使わない場合、キーワード引数は上述の例の他の引数に吸い込まれます。メソッドを拡張してキーワード引数を受け取るようにする場合、以下のような非互換性が発生する可能性があります。 {% highlight ruby %} -# If a method accepts rest argument and no `**nil` +# メソッドは残りの引数を受け取るが、`**nil`はない状態 def foo(*args) p args end -# Passing keywords are converted to a Hash object (even in Ruby 3.0) +# キーワード引数はHashオブジェクトに変換される(Ruby 3.0でも同じ) foo(k: 1) #=> [{:k=>1}] -# If the method is extended to accept a keyword +# メソッドがキーワード引数を受け取るよう拡張した場合 def foo(*args, mode: false) p args end -# The existing call may break +# 以下の呼び出しが壊れる可能性がある foo(k: 1) #=> ArgumentError: unknown keyword k {% endhighlight %} -## Why we're deprecating the automatic conversion +## 自動変換を非推奨に変える理由 -The automatic conversion initially appeared to be a good idea, and worked well in many cases. However, it had too many corner cases, and we have received many bug reports about the behavior. +当初、自動変換はうまいアイデアに思われていて、多くの場合問題なく機能していました。しかし、エッジケースがあまりにも多く、これまでこの振る舞いに関するバグレポートを山のように受け取りました。 -Automatic conversion does not work well when a method accepts optional positional arguments and keyword arguments. Some people expect the last Hash object to be treated as a positional argument, and others expect it to be converted to keyword arguments. +自動変換は、オプションの位置引数とキーワード引数をどちらも受け取るメソッドではうまく動きません。末尾のHashオブジェクトを位置引数として扱うことを期待する人々もいれば、末尾のHashオブジェクトをキーワード引数として扱うことを期待する人々もいました。 -Here is one of the most confusing cases: +最も混乱を呼ぶケースのひとつを以下に示します。 {% highlight ruby %} def foo(x, **kwargs) @@ -317,17 +320,17 @@ def bar(x=1, **kwargs) p [x, kwargs] end -foo({}) => [{}, {}] -bar({}) => [1, {}] +foo({}) #=> [{}, {}] +bar({}) #=> [1, {}] -bar({}, **{}) => expected: [{}, {}], actual: [1, {}] +bar({}, **{}) #=> 期待は: [{}, {}]だが実際はl: [1, {}] {% endhighlight %} -In Ruby 2, `foo({})` passes an empty hash as a normal argument (i.e., `{}` is assigned to `x`), while `bar({})` passes a keyword argument (i.e, `{}` is assigned to `kwargs`). So `any_method({})` is very ambiguous. +Ruby 2の場合、`foo({})`は空のハッシュを通常の引数として1つ渡しますが(`x`に`{}`が代入されるなど)、`bar({})`はキーワード引数を1つ渡します(`kwargs`に`{}`が代入されるなど)。つまり、`any_method({})`は極めてあいまいになります。 -You may think of `bar({}, **{})` to pass the empty hash to `x` explicitly. Surprisingly, it does not work as you expected; it still prints `[1, {}]` in Ruby 2.6. This is because `**{}` is ignored by the parser in Ruby 2.6, and the first argument `{}` is automatically converted to keywords (`**kwargs`). In this case, you need to call `bar({}, {})`, which is very weird. +「`bar({}, **{})`は`x`に明示的に空のハッシュを渡すのでは?」と考える人もいるかもしれませんが、驚いたことに、この期待は裏切られます。Ruby 2.6では`[1, {}]`が出力されるのです。理由は、`**{}`がRuby 2.6のパーサーで無視されるのと、1番目の引数`{}`が自動的にキーワード引数(`**kwargs`)に変換されるためです。この場合`bar({}, {})`という形で呼び出す必要がありますが、これではあまりに見苦しくなります。 -The same issues also apply to methods that accept rest and keyword arguments. This makes explicit delegation of keyword arguments not work. +同じ問題は、残りの引数とキーワード引数を受け取るメソッドにも当てはまります。そのせいで、以下のようなキーワード引数の明示的な委譲は動作しません。 {% highlight ruby %} def target(*args) @@ -338,18 +341,18 @@ def foo(*args, **kwargs, &block) target(*args, **kwargs, &block) end -foo() #=> Ruby 2.6 or before: [{}] - #=> Ruby 2.7 or later: [] +foo() #=> Ruby 2.6以前: [{}] + #=> Ruby 2.7以降: [] {% endhighlight %} -`foo()` passes no arguments, but `target` receives an empty hash argument in Ruby 2.6. This is because the method `foo` delegates keywords (`**kwargs`) explicitly. When `foo()` is called, `args` is an empty Array, `kwargs` is an empty Hash, and `block` is `nil`. And then `target(*args, **kwargs, &block)` passes an empty Hash as an argument because `**kwargs` is automatically converted to a positional Hash argument. +`foo()`には引数がありませんが、Ruby 2.6では空のハッシュ引数が`target`に渡されます。理由は、メソッド`foo`が明示的にキーワード(`**kwargs`)を委譲しているためです。`foo()`が呼び出されると、`args`は空のArrayになり、`kwargs`は空のHashになります。そして`target(*args, **kwargs, &block)`は空のHashを引数として1つ渡します。理由は、`**kwargs`が自動的にHash位置引数に変換されるためです。 -The automatic conversion not only confuses people but also makes the method less extensible. See [[Feature #14183]](https://bugs.ruby-lang.org/issues/14183) for more details about the reasons for the change in behavior, and why certain implementation choices were made. +自動変換は開発者を混乱させるのみならず、メソッドの拡張性も弱めてしまいます。振る舞いが変更された理由や、特定の実装が選択された理由について詳しくは[Feature #14183](https://bugs.ruby-lang.org/issues/14183)をご覧ください。 -## Acknowledgment +## 謝辞 -This article was kindly reviewed (or even co-authored) by Jeremy Evans and Benoit Daloze. +本記事はJeremy EvansとBenoit Dalozeによる丁寧なレビュー(共著と言ってもよいくらいです)をいただきました。 -## History +## 更新履歴 -* Updated 2019-12-25: In 2.7.0-rc2, the warning message was slightly changed, and an API to suppress the warnings was added. +* 更新 2019-12-25: 2.7.0-rc2でwarningメッセージが若干変更され、warning抑制APIが追加された。 From 14e04bc34672d0e27ba23212213843b764d3ad73 Mon Sep 17 00:00:00 2001 From: hachi8833 Date: Thu, 30 Jan 2020 16:49:40 +0900 Subject: [PATCH 0004/1090] Fix untranslated lines --- ...ation-of-positional-and-keyword-arguments-in-ruby-3-0.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ja/news/_posts/2019-12-12-separation-of-positional-and-keyword-arguments-in-ruby-3-0.md b/ja/news/_posts/2019-12-12-separation-of-positional-and-keyword-arguments-in-ruby-3-0.md index 5e80e231d5..b9aec21a12 100644 --- a/ja/news/_posts/2019-12-12-separation-of-positional-and-keyword-arguments-in-ruby-3-0.md +++ b/ja/news/_posts/2019-12-12-separation-of-positional-and-keyword-arguments-in-ruby-3-0.md @@ -1,6 +1,6 @@ --- layout: news_post -title: "Separation of positional and keyword arguments in Ruby 3.0" +title: "Ruby 3.0における位置引数とキーワード引数の分離について" author: "mame" translator: "hachi8833" date: 2019-12-12 12:00:00 +0000 @@ -13,8 +13,8 @@ lang: ja Ruby 3.0では、位置引数とキーワード引数が分離されます。Ruby 3.0で変更される振る舞いはRuby 2.7でwarningを表示します。以下のいずれかのwarningが表示される場合は、コードのアップデートが必要です。 -* `Using the last argument as keyword parameters is deprecated`, or -* `Passing the keyword argument as the last hash parameter is deprecated`, or +* `Using the last argument as keyword parameters is deprecated` +* `Passing the keyword argument as the last hash parameter is deprecated` * `Splitting the last argument into positional and keyword parameters is deprecated` この非互換性は、double splat演算子(`**`)を追加することでほぼ回避できます。これにより、`Hash`オブジェクトではなくキーワード引数を渡すことが明示的に指定されます。同様に、キーワード引数ではなく`Hash`オブジェクトを明示的に渡したい場合は中かっこ(`{}`)を追加できます。詳しくは後述の「典型的なケース」をご覧ください。 From 58db0375aef375d8a929d00b5f4d58372b7821a7 Mon Sep 17 00:00:00 2001 From: twlixin Date: Mon, 16 Nov 2020 01:18:45 +0900 Subject: [PATCH 0005/1090] Create 2020-04-05-support-of-ruby-2-4-has-ended.md --- ...020-04-05-support-of-ruby-2-4-has-ended.md | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 zh_tw/news/_posts/2020-04-05-support-of-ruby-2-4-has-ended.md diff --git a/zh_tw/news/_posts/2020-04-05-support-of-ruby-2-4-has-ended.md b/zh_tw/news/_posts/2020-04-05-support-of-ruby-2-4-has-ended.md new file mode 100644 index 0000000000..0dfe1bbb6b --- /dev/null +++ b/zh_tw/news/_posts/2020-04-05-support-of-ruby-2-4-has-ended.md @@ -0,0 +1,37 @@ +--- +layout: news_post +title: "Ruby 2.4 官方支持終了" +author: "usa" +translator: "twlixin" +date: 2020-04-05 12:00:00 +0000 +lang: zh_tw +--- + +Ruby 2.4 系列的官方支持終了期間之宣布。 + +昨年 4 月以來的 1 年間、Ruby 2.4系列處於安全維護期。正如先前所宣布的,官方支持將於2020年3月31日結束。 +之後,有簡單的錯誤修復或者即使發現安全問題,也不會針對Ruby 2.4系列發布新版本。 + +2020年3月31日,Ruby 2.4系列的最終版本2.4.10發布,這只是為了讓使用者更有時間轉移到較新的版本系列。 +如果您當前正在使用Ruby 2.4系列,請盡快轉換到較新的版本系列。 + +##關於當前支持的版本系列 + +### Ruby 2.7系列 + +目前處於正常維護階段。 +随時會更新版本,包括發現到的錯誤之修復。 +此外,如果發現嚴重的安全問題,將進行相對應的緊急版本更新。 + +### Ruby 2.6 系列 + +目前處於正常維護階段。 +随時會更新版本,包括發現到的錯誤之修復。 +此外,如果發現嚴重的安全問題,將進行相對應的緊急版本更新。 + +### Ruby 2.5 系列 + +目前處於安全維護期。 +不會針對一般的錯誤作修復。 +如果發現嚴重的安全問題,將進行相應的緊急版本更新。 +預定將於2021年3月結束官方的支持。 From e9c8021d79ed00d38332be7dd6aa708362e50153 Mon Sep 17 00:00:00 2001 From: Chatpitre Date: Fri, 26 Mar 2021 15:32:37 +0100 Subject: [PATCH 0006/1090] =?UTF-8?q?d=C3=A9but=20de=20traduction=202.7.2?= =?UTF-8?q?=20et=203.0.0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../_posts/2020-10-02-ruby-2-7-2-released.md | 69 ++++ ...2020-12-08-ruby-3-0-0-preview2-released.md | 370 +++++++++++++++++ .../2020-12-20-ruby-3-0-0-rc1-released.md | 322 +++++++++++++++ .../_posts/2020-12-25-ruby-3-0-0-released.md | 391 ++++++++++++++++++ 4 files changed, 1152 insertions(+) create mode 100644 fr/news/_posts/2020-10-02-ruby-2-7-2-released.md create mode 100644 fr/news/_posts/2020-12-08-ruby-3-0-0-preview2-released.md create mode 100644 fr/news/_posts/2020-12-20-ruby-3-0-0-rc1-released.md create mode 100644 fr/news/_posts/2020-12-25-ruby-3-0-0-released.md diff --git a/fr/news/_posts/2020-10-02-ruby-2-7-2-released.md b/fr/news/_posts/2020-10-02-ruby-2-7-2-released.md new file mode 100644 index 0000000000..08f8f9b2b0 --- /dev/null +++ b/fr/news/_posts/2020-10-02-ruby-2-7-2-released.md @@ -0,0 +1,69 @@ +--- +layout: news_post +title: "Ruby 2.7.2 est disponible" +author: "nagachika" +translator: "chatpitre" +date: 2020-10-02 11:00:00 +0000 +lang: en +--- + +Ruby 2.7.2 est désormais disponible. + +Cette version contient des incompatiblitées intentionnelles. Les avertissement de des déprécation sont désactivé par défaut dans la 2.7.2 et supérieur. Il est possible d'activer les avertissements en spécifiant l'option -w ou -W:deprecated en ligne de commande. Veuillez regarder les sujets ci-dessous pour plus de détails. + +This release contains intentional incompatibility. Deprecation warnings are off by default on 2.7.2 and later. +You can turn on deprecation warnings by specifying the -w or -W:deprecated option at the command-line. +Please check the topics below for details. + +- [Ticket #17000](https://bugs.ruby-lang.org/issues/17000) +- [Ticket #16345](https://bugs.ruby-lang.org/issues/16345) + +- [Feature #17000 2.7.2 turns off deprecation warnings by default](https://bugs.ruby-lang.org/issues/17000) +- [Feature #16345 Don't emit deprecation warnings by default.](https://bugs.ruby-lang.org/issues/16345) + +Cette version contient la nouvelle version de webrick avec une correction conscernant la sécurité comme décrit dans l'article suivant. + +This release contains the new version of webrick with a security fix described in the article. + +- [CVE-2020-25613: Potential HTTP Request Smuggling Vulnerability in WEBrick](/en/news/2020/09/29/http-request-smuggling-cve-2020-25613/) + +Veuillez lire les autres changement dans les logs de commits. +See the [commit logs](https://github.com/ruby/ruby/compare/v2_7_1...v2_7_2) for other changes. + +## Téléchargements + +{% assign release = site.data.releases | where: "version", "2.7.2" | first %} + +- <{{ release.url.bz2 }}> + + SIZE: {{ release.size.bz2 }} + SHA1: {{ release.sha1.bz2 }} + SHA256: {{ release.sha256.bz2 }} + SHA512: {{ release.sha512.bz2 }} + +- <{{ release.url.gz }}> + + SIZE: {{ release.size.gz }} + SHA1: {{ release.sha1.gz }} + SHA256: {{ release.sha256.gz }} + SHA512: {{ release.sha512.gz }} + +- <{{ release.url.xz }}> + + SIZE: {{ release.size.xz }} + SHA1: {{ release.sha1.xz }} + SHA256: {{ release.sha256.xz }} + SHA512: {{ release.sha512.xz }} + +- <{{ release.url.zip }}> + + SIZE: {{ release.size.zip }} + SHA1: {{ release.sha1.zip }} + SHA256: {{ release.sha256.zip }} + SHA512: {{ release.sha512.zip }} + +## Commentaire de la versionm + +Merci aux nombreux contributeurs, developpeurs et utilisateurs qui en remontant des rapports de bugs et contribuant ont rendu cette version possible. + +Thanks to the many committers, developers and users who provided bug reports and contributions that made this release possible. diff --git a/fr/news/_posts/2020-12-08-ruby-3-0-0-preview2-released.md b/fr/news/_posts/2020-12-08-ruby-3-0-0-preview2-released.md new file mode 100644 index 0000000000..508273d3bd --- /dev/null +++ b/fr/news/_posts/2020-12-08-ruby-3-0-0-preview2-released.md @@ -0,0 +1,370 @@ +--- +layout: news_post +title: "Ruby 3.0.0 Preview 2 est disponible" +author: "naruse" +translator: "chatpitre" +date: 2020-12-08 00:00:00 +0000 +lang: en +--- + +Nous sommes heureux de vous annoncer la sortie de Ruby 3.0.0-preview2. + +Cela introduit un certain nombre de nouvelles fonctionnalités et d'amélioration de performance. + +We are pleased to announce the release of Ruby 3.0.0-preview2. + +It introduces a number of new features and performance improvements. + +## Analyse statique + +## Static Analysis + +### RBS + +RBS est un langage qui décrit les types des programmes Ruby. + +RBS is a language to describe the types of Ruby programs. + +Les vérifications de type incluent TypeProf et d'autres outils supportant RBS qui comprennent les programmes Ruby bien mieux avec les définitions RBS. + +Type checkers including TypeProf and other tools supporting RBS will understand Ruby programs much better with RBS definitions. + +Vous pouvez écrire directement la définition des classes et modules : les méthodes définis dans la classe, les variables d'instances et leurs types et les relations d'héritage/mix-in. + +You can write down the definition of classes and modules: methods defined in the class, instance variables and their types, and inheritance/mix-in relations. + +Le but de RBS est de supporter les patterns communs dans les programmes Ruby et de permettre d'écrire des types avancés incluant les unions de types, la surcharge de méthode et les génériques. Cela supporte aussi le duck typing avec _interface types_. + +The goal of RBS is to support commonly seen patterns in Ruby programs and it allows writing advanced types including union types, method overloading, and generics. It also supports duck typing with _interface types_. + +Ruby 3.0 arrive avec la gem `rbs`, qui inclue l'analyse et le traitement des définitions de type écrit en RBS. +Le code ci-dessous est un petit exemple de RBS avec une des définitions de classe, module et constante. + +Ruby 3.0 ships with `rbs` gem, which allows parsing and processing type definitions written in RBS. +The following is a small example of RBS with class, module, and constant definitions. + +```rbs +module ChatApp + VERSION: String + class Channel + attr_reader name: String + attr_reader messages: Array[Message] + attr_reader users: Array[User | Bot] # `|` means union types, `User` or `Bot`. + def initialize: (String) -> void + def post: (String, from: User | Bot) -> Message # Method overloading is supported. + | (File, from: User | Bot) -> Message + end +end +``` + +Voir le [README de la gem rbs](https://github.com/ruby/rbs) pour plus de détails. + +See [README of rbs gem](https://github.com/ruby/rbs) for more detail. + +### TypeProf + +TypeProf est un outil d'analyse de type compris dans Ruby. + +TypeProf is a type analysis tool bundled in the Ruby package. + +Actuellement, TypeProf permet une sorte d'inférence de type. + +Currently, TypeProf serves as a kind of type inference. + +Cela lit du code Ruby non annoté, analyse quelles méthodes sont définis, comment elles sont utilités et générenet un prototype de signature de type au format RBS. + +It reads plain (non-type-annotated) Ruby code, analyzes what methods are defined and how they are used, and generates a prototype of type signature in RBS format. + +Here is a simple demo of TypeProf. + +An example input: + +Un exemple d'entrée : + +```ruby +# test.rb +class User + def initialize(name:, age:) + @name, @age = name, age + end + attr_reader :name, :age +end +User.new(name: "John", age: 20) +``` + +Un exemple de sortie : + +An example output: + +``` +$ typeprof test.rb +# Classes +class User + attr_reader name : String + attr_reader age : Integer + def initialize : (name: String, age: Integer) -> [String, Integer] +end +``` + +Vous pouvez lancer TypeProf en sauvegadant l'entrée dans un fichier "test.rb" et en appelant la commande "typeprof test.rb". + +You can run TypeProf by saving the input as "test.rb" and invoke a command called "typeprof test.rb". + +Vous pouvez aussi [essayer TypeProf en ligne](https://mame.github.io/typeprof-playground/#rb=%23+test.rb%0Aclass+User%0A++def+initialize%28name%3A%2C+age%3A%29%0A++++%40name%2C+%40age+%3D+name%2C+age%0A++end%0A++%0A++attr_reader+%3Aname%2C+%3Aage%0Aend%0A%0AUser.new%28name%3A+%22John%22%2C+age%3A+20%29&rbs=). (Cela lance TypeProf coté serveur, donc désolé si c'est) + +You can also [try TypeProf online](https://mame.github.io/typeprof-playground/#rb=%23+test.rb%0Aclass+User%0A++def+initialize%28name%3A%2C+age%3A%29%0A++++%40name%2C+%40age+%3D+name%2C+age%0A++end%0A++%0A++attr_reader+%3Aname%2C+%3Aage%0Aend%0A%0AUser.new%28name%3A+%22John%22%2C+age%3A+20%29&rbs=). (It runs TypeProf on the server side, so sorry if it is out!) + +Voir [la documentation](https://github.com/ruby/typeprof/blob/master/doc/doc.md) and [les demos](https://github.com/ruby/typeprof/blob/master/doc/demo.md) pour plus de détails. + +See [the documentation](https://github.com/ruby/typeprof/blob/master/doc/doc.md) and [demos](https://github.com/ruby/typeprof/blob/master/doc/demo.md) for details. + +TypeProf est expérimental et n'est pas encore mature. Seulement un sous ensemble du langage Ruby est supporté et la détection des erreurs de typage est limitée. Cela évolue rapidement tout de même afin d'améliorer la couvertures des fonctionnalités du langage, l'analyse de performance et la maniabilité. Tout retour est le bienvenue. + +TypeProf is experimental and not so mature yet; only a subset of the Ruby language is supported, and the detection of type errors is limited. But it is still growing rapidly to improve the coverage of language features, the analysis performance, and usability. Any feedback is very welcome. + +## Ractor (experimental) + +Ractor est un modèle d'acteur permettant une abstraction pour la concurrence. Il fournit un outil permettant l'execution thread-safe de code. + +Ractor is an Actor-model like concurrent abstraction designed to provide a parallel execution feature without thread-safety concerns. + +Vous pouvez créer plusieurs ractors et les lancer en parallele. Ractor vous permet de créer des programmes thread-safe car les reactors ne partage pas des objets normaux. La communication entre ractors se fait par passage de message. + +You can make multiple ractors and you can run them in parallel. Ractor enables you to make thread-safe parallel programs because ractors can not share normal objects. Communication between ractors are supported by message passing. + +Afin de limiter le partage d'objet, Ractor introduit plusieurs restriction sur la syntaxe de Ruby (sans plusieurs ractors, il n'y a pas de restriction). + +To limit sharing of objects, Ractor introduces several restrictions to the Ruby's syntax (without multiple Ractors, there is no restriction). + +La spécification et l'implémintation ne sont pas matures et peuvent changer dans le futur. Par conséquent cette fonctionnalité est marquée commme experimentale et montre l'avertissement "experimental feature" au premier `Ractor.new`. + +The specification and implementation are not matured and may be changed in the future, so this feature is marked as experimental and show the "experimental feature" warning when the first `Ractor.new`. + +Le petit programme suivant calcul `n.prime?` (`n` est un entier relativement grand) en parallele avec deux ractors. Vous pouvez vérifier que le programme est deux fois plus rapide que celui séquentiel sur le calcul parralele. + +The following small program calculates `n.prime?` (`n` is relatively a big integer) in parallel with two ractors. You will confirm that the program execution is about x2 times faster compared to the sequential program on the parallel computer. + +```ruby +require 'prime' +# n.prime? with sent integers in r1, r2 run in parallel +r1, r2 = *(1..2).map do + Ractor.new do + n = Ractor.recv + n.prime? + end +end +# send parameters +r1.send 2**61 - 1 +r2.send 2**61 + 15 +# wait for the results of expr1, expr2 +p r1.take #=> true +p r2.take #=> true +``` + +Voir [doc/ractor.md](https://github.com/ruby/ruby/blob/master/doc/ractor.md) pour plus de details. + +See [doc/ractor.md](https://github.com/ruby/ruby/blob/master/doc/ractor.md) for more details. + +## Fiber Scheduler + +`Fiber#scheduler` est introduit pour intercepter des opérations de blocage. Cela permet une concurrence légère sans changer le code existant. Voir ["Don't Wait For Me, Scalable Concurrency for Ruby 3"](https://www.youtube.com/watch?v=Y29SSOS4UOc) pour avoir un apercu du fonctionnement. + +`Fiber#scheduler` is introduced for intercepting blocking operations. This allows for light-weight concurrency without changing existing code. Watch ["Don't Wait For Me, Scalable Concurrency for Ruby 3"](https://www.youtube.com/watch?v=Y29SSOS4UOc) for an overview of how it works. + +Currently supported classes/methods: +Les classes et méthodes prises en charge: + +- `Mutex#lock`, `Mutex#unlock`, `Mutex#sleep` +- `ConditionVariable#wait` +- `Queue#pop`, `SizedQueue#push` +- `Thread#join` +- `Kernel#sleep` +- `Process.wait` +- `IO#wait`, `IO#read`, `IO#write` et les méthodes rattachées (e.g. `#wait_readable`, `#gets`, `#puts` etc.) +- `IO#select` n'est _pas prise en charge_. + +Cet exemple de code permet de faire plusieurs requetes HTTP de facon concurrente. +(Expliquer la gem Async avec des liens). Cet exemple de code permet de faire plusieurs requetes HTTP de facon concurrente. +(Explain Async gem with links). This example program will perform several HTTP requests concurrently: +(Expler ceci:) + +1. async est une gemme externe +2. async utilise cette nouvelle fonctionnalité + +```ruby +require 'async' +require 'net/http' +require 'uri' +Async do + ["ruby", "python", "c"].each do |topic| + Async do + Net::HTTP.get(URI "https://www.google.com/search?q=#{topic}") + end + end +end +``` + +## Autres ajouts notables + +## Other Notable New Features + +- Le filtrage par motif en une ligne utilise `=>` au lieu de `in`. +- One-line pattern matching now uses `=>` instead of `in`. + ```ruby + # version 3.0 + {a: 0, b: 1} => {a:} + p a # => 0 + # version 2.7 + {a: 0, b: 1} in {a:} + p a # => 0 + ``` +- Le pattern Find. + ```ruby + case ["a", 1, "b", "c", 2, "d", "e", "f", 3] + in [*pre, String => x, String => y, *post] + p pre #=> ["a", 1] + p x #=> "b" + p y #=> "c" + p post #=> [2, "d", "e", "f", 3] + end + ``` +- La définition sans le mot clé `end`. + ```ruby + def square(x) = x * x + ``` +- `Hash#except` est désormais intégré. + ```ruby + h = { a: 1, b: 2, c: 3 } + p h.except(:a) #=> {:b=>2, :c=>3} + ``` +- Memory view est ajoutée en tant que fonctionnalité experimentale + + - C'est un nouvel ensemble d'API C pour échanger une zone mémoire brute, comme un tableau de nombre ou une image bitmap, entre des bibliotheques d'extension. Les bibliotheques d'extension permettent aussi de partager les méta données de la zone mémoire qui est constituée de la forme, du format de l'élément, etc. En utilisant ce types de métadata, les librairies d'extenstion peuvent partager meme des tableau multidimensionnel de facon approprié. Cette fonctionnalité est concu en se referrant au protocol tampon de python. + + - This is a new C-API set to exchange a raw memory area, such as a numeric array and a bitmap image, between extension libraries. The extension libraries can share also the metadata of the memory area that consists of the shape, the element format, and so on. Using these kinds of metadata, the extension libraries can share even a multidimensional array appropriately. This feature is designed by referring to Python's buffer protocol. + +## Amélioration des performances + +## Performance improvements + +- Plusieurs améliorations sont implémentées dans MJIT. Voir NEWS pour les details. +- Coller du code dans IRB est 53 fois plus rapide qu'en Ruby 2.7.0. Par exemple le temps nécessaire pour coller [cet exemple de code](https://gist.github.com/aycabta/30ab96334275bced5796f118c9220b0b) passe de 11.7 secondes à 0.22 secondes. + +- Many improvements were implemented in MJIT. Voir NEWS pour les details. +- Pasting long code to IRB is 53 times faster than bundled with Ruby 2.7.0. For example, the time required to paste [this sample code](https://gist.github.com/aycabta/30ab96334275bced5796f118c9220b0b) goes from 11.7 seconds to 0.22 seconds. + +## Autres changements notables depuis la version 2.7 + +## Other notable changes since 2.7 + +- Les arguments de mot clé sont séparé des autres arguments. + - En principe, le code qui affiche un avertissement dans la version 2.7 de ruby ne fonctionnera pas. Voir le [document](https://www.ruby-lang.org/en/news/2019/12/12/separation-of-positional-and-keyword-arguments-in-ruby-3-0/) pour plus de détails. + - La transmission d'arguments prend en charge les arguments de l'en-tête. + ```ruby + def method_missing(meth, ...) + send(:"do_#{ meth }", ...) + end + ``` +- La fonctionnalité `$SAFE` a été completement supprimée. C'est désormais une variable globale. +- L'ordre de la backtrace a été inversé depuis la version 2.5 de Ruby, mais cela a été remis comme avant. Cela se comporte comme la version 2.4 de Ruby. Le message d'erreur et le numéro de ligne ou l'exception apparait sont affichés en premiers. Les appelants sont affichés apres. +- Plusieurs bibliothèques standard ont été mises à jour. + - RubyGems 3.2.0.rc.1 + - Bundler 2.2.0.rc.1 + - IRB 1.2.6 + - Reline 0.1.5 +- Les librairies suivantes ne sont plus empaquetées. Il faut installer jes gems correspondantes pour utiliser leurs fonctionnalitées. + - net-telnet + - xmlrpc +- Les gems suivantes sont désormais empaquetées avec Ruby. + - rexml + - rss +- Les fichiers stdlib suivants sont désormais des gems et sont publiées sur rubygems.org. The following stdlib files are now default gems and are published on rubygems.org. + +- Keyword arguments are separated from other arguments. + - In principle, code that prints a warning on Ruby 2.7 won't work. See the [document](https://www.ruby-lang.org/en/news/2019/12/12/separation-of-positional-and-keyword-arguments-in-ruby-3-0/) in detail. + - By the way, arguments forwarding now supports leading arguments. + ```ruby + def method_missing(meth, ...) + send(:"do_#{ meth }", ...) + end + ``` +- The `$SAFE` feature was completely removed; now it is a normal global variable. +- The order of backtrace had been reversed at Ruby 2.5, and is reverted. Now it behaves like Ruby 2.4; an error message and the line number where the exception occurs are printed first, and its callers are printed later. +- Some standard libraries are updated. + - RubyGems 3.2.0.rc.1 + - Bundler 2.2.0.rc.1 + - IRB 1.2.6 + - Reline 0.1.5 +- The following libraries are no longer bundled gems. + Install the corresponding gems to use these features. + - net-telnet + - xmlrpc +- The following default gems are now bundled gems. + - rexml + - rss +- The following stdlib files are now default gems and are published on rubygems.org. + - abbrev + - base64 + - English + - erb + - find + - io-nonblock + - io-wait + - net-ftp + - net-http + - net-imap + - net-protocol + - nkf + - open-uri + - optparse + - resolv + - resolv-replace + - rinda + - securerandom + - set + - shellwords + - tempfile + - time + - tmpdir + - tsort + - weakref + +See [NEWS](https://github.com/ruby/ruby/blob/v3_0_0_preview2/NEWS.md) +or [commit logs](https://github.com/ruby/ruby/compare/v2_7_0...v3_0_0_preview2) +for more details. + +{% assign release = site.data.releases | where: "version", "3.0.0-preview2" | first %} + +With those changes, [{{ release.stats.files_changed }} files changed, {{ release.stats.insertions }} insertions(+), {{ release.stats.deletions }} deletions(-)](https://github.com/ruby/ruby/compare/v2_7_0...v3_0_0) +since Ruby 2.7.0! + +Please try Ruby 3.0.0-preview2, and give us any feedback! + +## Download + +- <{{ release.url.gz }}> + + SIZE: {{ release.size.gz }} + SHA1: {{ release.sha1.gz }} + SHA256: {{ release.sha256.gz }} + SHA512: {{ release.sha512.gz }} + +- <{{ release.url.xz }}> + + SIZE: {{ release.size.xz }} + SHA1: {{ release.sha1.xz }} + SHA256: {{ release.sha256.xz }} + SHA512: {{ release.sha512.xz }} + +- <{{ release.url.zip }}> + + SIZE: {{ release.size.zip }} + SHA1: {{ release.sha1.zip }} + SHA256: {{ release.sha256.zip }} + SHA512: {{ release.sha512.zip }} + +## What is Ruby + +Ruby was first developed by Matz (Yukihiro Matsumoto) in 1993, +and is now developed as Open Source. It runs on multiple platforms +and is used all over the world especially for web development. diff --git a/fr/news/_posts/2020-12-20-ruby-3-0-0-rc1-released.md b/fr/news/_posts/2020-12-20-ruby-3-0-0-rc1-released.md new file mode 100644 index 0000000000..ac3f7b0c77 --- /dev/null +++ b/fr/news/_posts/2020-12-20-ruby-3-0-0-rc1-released.md @@ -0,0 +1,322 @@ +--- +layout: news_post +title: "Ruby 3.0.0 RC1 Released" +author: "naruse" +translator: "chatpitre" +date: 2020-12-20 00:00:00 +0000 +lang: en +--- + +We are pleased to announce the release of Ruby 3.0.0-rc1. + +It introduces a number of new features and performance improvements. + +## Static Analysis + +### RBS + +RBS is a language to describe the types of Ruby programs. + +Type checkers including TypeProf and other tools supporting RBS will understand Ruby programs much better with RBS definitions. + +You can write down the definition of classes and modules: methods defined in the class, instance variables and their types, and inheritance/mix-in relations. + +The goal of RBS is to support commonly seen patterns in Ruby programs and it allows writing advanced types including union types, method overloading, and generics. It also supports duck typing with _interface types_. + +Ruby 3.0 ships with `rbs` gem, which allows parsing and processing type definitions written in RBS. +The following is a small example of RBS with class, module, and constant definitions. + +```rbs +module ChatApp + VERSION: String + class Channel + attr_reader name: String + attr_reader messages: Array[Message] + attr_reader users: Array[User | Bot] # `|` means union types, `User` or `Bot`. + def initialize: (String) -> void + def post: (String, from: User | Bot) -> Message # Method overloading is supported. + | (File, from: User | Bot) -> Message + end +end +``` + +See [README of rbs gem](https://github.com/ruby/rbs) for more detail. + +### TypeProf + +TypeProf is a type analysis tool bundled in the Ruby package. + +Currently, TypeProf serves as a kind of type inference. + +It reads plain (non-type-annotated) Ruby code, analyzes what methods are defined and how they are used, and generates a prototype of type signature in RBS format. + +Here is a simple demo of TypeProf. + +An example input: + +```ruby +# test.rb +class User + def initialize(name:, age:) + @name, @age = name, age + end + attr_reader :name, :age +end +User.new(name: "John", age: 20) +``` + +An example output: + +``` +$ typeprof test.rb +# Classes +class User + attr_reader name : String + attr_reader age : Integer + def initialize : (name: String, age: Integer) -> [String, Integer] +end +``` + +You can run TypeProf by saving the input as "test.rb" and invoke a command called "typeprof test.rb". + +You can also [try TypeProf online](https://mame.github.io/typeprof-playground/#rb=%23+test.rb%0Aclass+User%0A++def+initialize%28name%3A%2C+age%3A%29%0A++++%40name%2C+%40age+%3D+name%2C+age%0A++end%0A++%0A++attr_reader+%3Aname%2C+%3Aage%0Aend%0A%0AUser.new%28name%3A+%22John%22%2C+age%3A+20%29&rbs=). (It runs TypeProf on the server side, so sorry if it is out!) + +See [the documentation](https://github.com/ruby/typeprof/blob/master/doc/doc.md) and [demos](https://github.com/ruby/typeprof/blob/master/doc/demo.md) for details. + +TypeProf is experimental and not so mature yet; only a subset of the Ruby language is supported, and the detection of type errors is limited. But it is still growing rapidly to improve the coverage of language features, the analysis performance, and usability. Any feedback is very welcome. + +## Ractor (experimental) + +Ractor is an Actor-model like concurrent abstraction designed to provide a parallel execution feature without thread-safety concerns. + +You can make multiple ractors and you can run them in parallel. Ractor enables you to make thread-safe parallel programs because ractors can not share normal objects. Communication between ractors are supported by message passing. + +To limit sharing of objects, Ractor introduces several restrictions to the Ruby's syntax (without multiple Ractors, there is no restriction). + +The specification and implementation are not matured and may be changed in the future, so this feature is marked as experimental and show the "experimental feature" warning when the first `Ractor.new`. + +The following small program calculates `n.prime?` (`n` is relatively a big integer) in parallel with two ractors. You will confirm that the program execution is about x2 times faster compared to the sequential program on the parallel computer. + +```ruby +require 'prime' +# n.prime? with sent integers in r1, r2 run in parallel +r1, r2 = *(1..2).map do + Ractor.new do + n = Ractor.receive + n.prime? + end +end +# send parameters +r1.send 2**61 - 1 +r2.send 2**61 + 15 +# wait for the results of expr1, expr2 +p r1.take #=> true +p r2.take #=> true +``` + +See [doc/ractor.md](https://github.com/ruby/ruby/blob/master/doc/ractor.md) for more details. + +## Fiber Scheduler + +`Fiber#scheduler` is introduced for intercepting blocking operations. This allows for light-weight concurrency without changing existing code. Watch ["Don't Wait For Me, Scalable Concurrency for Ruby 3"](https://www.youtube.com/watch?v=Y29SSOS4UOc) for an overview of how it works. + +Currently supported classes/methods: + +- `Mutex#lock`, `Mutex#unlock`, `Mutex#sleep` +- `ConditionVariable#wait` +- `Queue#pop`, `SizedQueue#push` +- `Thread#join` +- `Kernel#sleep` +- `Process.wait` +- `IO#wait`, `IO#read`, `IO#write` and related methods (e.g. `#wait_readable`, `#gets`, `#puts` and so on). +- `IO#select` is _not supported_. + +(Explain Async gem with links). This example program will perform several HTTP requests concurrently: + +(Explain this:) + +1. async is outer gem +2. async uses this new feature + +```ruby +require 'async' +require 'net/http' +require 'uri' +Async do + ["ruby", "python", "c"].each do |topic| + Async do + Net::HTTP.get(URI "https://www.google.com/search?q=#{topic}") + end + end +end +``` + +## Other Notable New Features + +- One-line pattern matching is redesigned. (experimental) + + - `=>` is added. It can be used as like rightward assignment. + + ```ruby + 0 => a + p a #=> 0 + + {b: 0, c: 1} => {b:} + p b #=> 0 + ``` + + - `in` is changed to return `true` or `false`. + + ```ruby + # version 3.0 + 0 in 1 #=> false + + # version 2.7 + 0 in 1 #=> raise NoMatchingPatternError + ``` + +- Find pattern is added. (experimental) + + ```ruby + case ["a", 1, "b", "c", 2, "d", "e", "f", 3] + in [*pre, String => x, String => y, *post] + p pre #=> ["a", 1] + p x #=> "b" + p y #=> "c" + p post #=> [2, "d", "e", "f", 3] + end + ``` + +- Endless method definition is added. + + ```ruby + def square(x) = x * x + ``` + +- `Hash#except` is now built-in. + + ```ruby + h = { a: 1, b: 2, c: 3 } + p h.except(:a) #=> {:b=>2, :c=>3} + ``` + +- Memory view is added as an experimental feature + + - This is a new C-API set to exchange a raw memory area, such as a numeric array and a bitmap image, between extension libraries. The extension libraries can share also the metadata of the memory area that consists of the shape, the element format, and so on. Using these kinds of metadata, the extension libraries can share even a multidimensional array appropriately. This feature is designed by referring to Python's buffer protocol. + +## Performance improvements + +- Many improvements were implemented in MJIT. See NEWS in detail. +- Pasting long code to IRB is 53 times faster than bundled with Ruby 2.7.0. For example, the time required to paste [this sample code](https://gist.github.com/aycabta/30ab96334275bced5796f118c9220b0b) goes from 11.7 seconds to 0.22 seconds. + +## Other notable changes since 2.7 + +- Keyword arguments are separated from other arguments. + + - In principle, code that prints a warning on Ruby 2.7 won't work. See the [document](https://www.ruby-lang.org/en/news/2019/12/12/separation-of-positional-and-keyword-arguments-in-ruby-3-0/) in detail. + - By the way, arguments forwarding now supports leading arguments. + + ```ruby + def method_missing(meth, ...) + send(:"do_#{ meth }", ...) + end + ``` + +- Pattern matching (`case`/`in`) is no longer experimental. +- The `$SAFE` feature was completely removed; now it is a normal global variable. +- The order of backtrace had been reversed at Ruby 2.5, and is reverted. Now it behaves like Ruby 2.4; an error message and the line number where the exception occurs are printed first, and its callers are printed later. +- Some standard libraries are updated. + - RubyGems 3.2.2 + - Bundler 2.2.2 + - IRB 1.2.6 + - Reline 0.1.5 + - Psych 3.2.1 + - JSON 2.4.1 + - BigDecimal 3.0.0 + - CSV 3.1.9 + - Digest 3.0.0 + - Fiddle 1.0.4 + - StringIO 3.0.0 + - StringScanner 3.0.0 +- The following libraries are no longer bundled gems. + Install the corresponding gems to use these features. + - net-telnet + - xmlrpc +- The following default gems are now bundled gems. + - rexml + - rss +- The following stdlib files are now default gems and are published on rubygems.org. + - English + - abbrev + - base64 + - drb + - debug + - erb + - find + - net-ftp + - net-http + - net-imap + - net-protocol + - open-uri + - optparse + - pp + - prettyprint + - resolv-replace + - resolv + - rinda + - set + - securerandom + - shellwords + - tempfile + - tmpdir + - time + - tsort + - un + - weakref + - digest + - io-nonblock + - io-wait + - nkf + - pathname + - syslog + - win32ole + +See [NEWS](https://github.com/ruby/ruby/blob/v3_0_0_rc1/NEWS.md) +or [commit logs](https://github.com/ruby/ruby/compare/v2_7_0...v3_0_0_rc1) +for more details. + +{% assign release = site.data.releases | where: "version", "3.0.0-rc1" | first %} + +With those changes, [{{ release.stats.files_changed }} files changed, {{ release.stats.insertions }} insertions(+), {{ release.stats.deletions }} deletions(-)](https://github.com/ruby/ruby/compare/v2_7_0...v3_0_0) +since Ruby 2.7.0! + +Please try Ruby 3.0.0-rc1, and give us any feedback! + +## Download + +- <{{ release.url.gz }}> + + SIZE: {{ release.size.gz }} + SHA1: {{ release.sha1.gz }} + SHA256: {{ release.sha256.gz }} + SHA512: {{ release.sha512.gz }} + +- <{{ release.url.xz }}> + + SIZE: {{ release.size.xz }} + SHA1: {{ release.sha1.xz }} + SHA256: {{ release.sha256.xz }} + SHA512: {{ release.sha512.xz }} + +- <{{ release.url.zip }}> + + SIZE: {{ release.size.zip }} + SHA1: {{ release.sha1.zip }} + SHA256: {{ release.sha256.zip }} + SHA512: {{ release.sha512.zip }} + +## What is Ruby + +Ruby was first developed by Matz (Yukihiro Matsumoto) in 1993, +and is now developed as Open Source. It runs on multiple platforms +and is used all over the world especially for web development. diff --git a/fr/news/_posts/2020-12-25-ruby-3-0-0-released.md b/fr/news/_posts/2020-12-25-ruby-3-0-0-released.md new file mode 100644 index 0000000000..bb8bcb433b --- /dev/null +++ b/fr/news/_posts/2020-12-25-ruby-3-0-0-released.md @@ -0,0 +1,391 @@ +--- +layout: news_post +title: "Ruby 3.0.0 est disponible" +author: "naruse" +translator: "chatpitre" +date: 2020-12-25 00:00:00 +0000 +lang: en +--- + +We are pleased to announce the release of Ruby 3.0.0. From 2015 we developed hard toward Ruby 3, whose goal is performance, concurrency, and Typing. Especially about performance, Matz stated "Ruby3 will be 3 times faster than Ruby2" a.k.a. [Ruby 3x3](https://blog.heroku.com/ruby-3-by-3). + +{% assign release = site.data.releases | where: "version", "3.0.0" | first %} + +Optcarrot 3000 frames + +With [Optcarrot benchmark](https://github.com/mame/optcarrot), which measures single thread performance based on NES's game emulation workload, it achieved 3x faster performance than Ruby 2.0!
These were measured at the environment noted in [benchmark-driver.github.io/hardware.html](https://benchmark-driver.github.io/hardware.html). [Commit 8c510e4095](https://github.com/ruby/ruby/commit/8c510e4095) was used as Ruby 3.0. It may not be 3x faster depending on your environment or benchmark.
+ +Ruby 3.0.0 covers those goals by + +- Performance + - MJIT +- Concurrency + - Ractor + - Fiber Scheduler +- Typing (Static Analysis) + - RBS + - TypeProf + +With the above performance improvement, Ruby 3.0 introduces several new features described below. + +## Performance + +> When I first declared "Ruby3x3" in the conference keynote, many including members of the core team felt "Matz is a boaster". In fact, I felt so too. But we did. I am honored to see the core team actually accomplished to make Ruby3.0 three times faster than Ruby2.0 (in some benchmarks). -- Matz + +### MJIT + +Many improvements were implemented in MJIT. See NEWS for details. + +As of Ruby 3.0, JIT is supposed to give performance improvements in limited workloads, such as games ([Optcarrot](https://benchmark-driver.github.io/benchmarks/optcarrot/commits.html#chart-1)), AI ([Rubykon](https://benchmark-driver.github.io/benchmarks/rubykon/commits.html)), or whatever application that spends the majority of time in calling a few methods many times. + +Although Ruby 3.0 [significantly decreased the size of JIT-ed code](https://twitter.com/k0kubun/status/1256142302608650244), it is still not ready for optimizing workloads like Rails, which often spend time on so many methods and therefore suffer from i-cache misses exacerbated by JIT. Stay tuned for Ruby 3.1 for further improvements on this issue. + +## Concurrency / Parallel + +> It's multi-core age today. Concurrency is very important. With Ractor, along with Async Fiber, Ruby will be a real concurrent language. --- Matz + +### Ractor (experimental) + +Ractor is an Actor-model like concurrent abstraction designed to provide a parallel execution feature without thread-safety concerns. + +You can make multiple ractors and you can run them in parallel. Ractor enables you to make thread-safe parallel programs because ractors can not share normal objects. Communication between ractors is supported by exchanging messages. + +To limit the sharing of objects, Ractor introduces several restrictions to Ruby's syntax (without multiple Ractors, there is no restriction). + +The specification and implementation are not matured and may be changed in the future, so this feature is marked as experimental and shows the "experimental feature" warning when the first `Ractor.new` occurs. + +The following small program measures the execution time of the famous benchmark tak function ([Tak (function) - Wikipedia]()), by executing it 4 times sequentially or 4 times in parallel with ractors. + +```ruby +def tarai(x, y, z) = + x <= y ? y : tarai(tarai(x-1, y, z), + tarai(y-1, z, x), + tarai(z-1, x, y)) +require 'benchmark' +Benchmark.bm do |x| + # sequential version + x.report('seq'){ 4.times{ tarai(14, 7, 0) } } + + # parallel version + x.report('par'){ + 4.times.map do + Ractor.new { tarai(14, 7, 0) } + end.each(&:take) + } +end +``` + +``` +Benchmark result: + user system total real +seq 64.560736 0.001101 64.561837 ( 64.562194) +par 66.422010 0.015999 66.438009 ( 16.685797) +``` + +The result was measured on Ubuntu 20.04, Intel(R) Core(TM) i7-6700 (4 cores, 8 hardware threads). It shows that the parallel version is 3.87 times faster than the sequential version. + +See [doc/ractor.md](https://docs.ruby-lang.org/en/3.0.0/doc/ractor_md.html) for more details. + +### Fiber Scheduler + +`Fiber#scheduler` is introduced for intercepting blocking operations. This allows for light-weight concurrency without changing existing code. Watch ["Don't Wait For Me, Scalable Concurrency for Ruby 3"](https://www.youtube.com/watch?v=Y29SSOS4UOc) for an overview of how it works. + +Currently supported classes/methods: + +- `Mutex#lock`, `Mutex#unlock`, `Mutex#sleep` +- `ConditionVariable#wait` +- `Queue#pop`, `SizedQueue#push` +- `Thread#join` +- `Kernel#sleep` +- `Process.wait` +- `IO#wait`, `IO#read`, `IO#write`, and related methods (e.g. `#wait_readable`, `#gets`, `#puts`, and so on). +- `IO#select` is _not supported_. + +This example program will perform several HTTP requests concurrently: + +```ruby +require 'async' +require 'net/http' +require 'uri' + +Async do + ["ruby", "rails", "async"].each do |topic| + Async do + Net::HTTP.get(URI "https://www.google.com/search?q=#{topic}") + end + end +end +``` + +It uses [async](https://github.com/socketry/async) which provides the event loop. This event loop uses the `Fiber#scheduler` hooks to make `Net::HTTP` non-blocking. Other gems can use this interface to provide non-blocking execution for Ruby, and those gems can be compatible with other implementations of Ruby (e.g. JRuby, TruffleRuby) which can support the same non-blocking hooks. + +## Static Analysis + +> 2010s were an age of statically typed programming languages. Ruby seeks the future with static type checking, without type declaration, using abstract interpretation. RBS & TypeProf are the first step to the future. More steps to come. --- Matz + +### RBS + +RBS is a language to describe the types of Ruby programs. + +Type checkers including TypeProf and other tools supporting RBS will understand Ruby programs much better with RBS definitions. + +You can write down the definition of classes and modules: methods defined in the class, instance variables and their types, and inheritance/mix-in relations. + +The goal of RBS is to support commonly seen patterns in Ruby programs and it allows writing advanced types including union types, method overloading, and generics. It also supports duck typing with _interface types_. + +Ruby 3.0 ships with the `rbs` gem, which allows parsing and processing type definitions written in RBS. +The following is a small example of RBS with class, module, and constant definitions. + +```rbs +module ChatApp + VERSION: String + class Channel + attr_reader name: String + attr_reader messages: Array[Message] + attr_reader users: Array[User | Bot] # `|` means union types, `User` or `Bot`. + def initialize: (String) -> void + def post: (String, from: User | Bot) -> Message # Method overloading is supported. + | (File, from: User | Bot) -> Message + end +end +``` + +See [README of rbs gem](https://github.com/ruby/rbs) for more detail. + +### TypeProf + +TypeProf is a type analysis tool bundled in the Ruby package. + +Currently, TypeProf serves as a kind of type inference. + +It reads plain (non-type-annotated) Ruby code, analyzes what methods are defined and how they are used, and generates a prototype of type signature in RBS format. + +Here is a simple demo of TypeProf. + +An example input: + +```ruby +# test.rb +class User + def initialize(name:, age:) + @name, @age = name, age + end + attr_reader :name, :age +end +User.new(name: "John", age: 20) +``` + +An example output: + +``` +$ typeprof test.rb +# Classes +class User + attr_reader name : String + attr_reader age : Integer + def initialize : (name: String, age: Integer) -> [String, Integer] +end +``` + +You can run TypeProf by saving the input as "test.rb" and invoking the command "typeprof test.rb". + +You can also [try TypeProf online](https://mame.github.io/typeprof-playground/#rb=%23+test.rb%0Aclass+User%0A++def+initialize%28name%3A%2C+age%3A%29%0A++++%40name%2C+%40age+%3D+name%2C+age%0A++end%0A++%0A++attr_reader+%3Aname%2C+%3Aage%0Aend%0A%0AUser.new%28name%3A+%22John%22%2C+age%3A+20%29&rbs=). (It runs TypeProf on the server side, so sorry if it is out!) + +See the [TypeProf documentation](https://github.com/ruby/typeprof/blob/master/doc/doc.md) and [demos](https://github.com/ruby/typeprof/blob/master/doc/demo.md) for details. + +TypeProf is experimental and not so mature yet; only a subset of the Ruby language is supported, and the detection of type errors is limited. But it is still growing rapidly to improve the coverage of language features, the analysis performance, and usability. Any feedback is very welcome. + +## Other Notable New Features + +- One-line pattern matching is redesigned. (experimental) + + - `=>` is added. It can be used like a rightward assignment. + + ```ruby + 0 => a + p a #=> 0 + + {b: 0, c: 1} => {b:} + p b #=> 0 + ``` + + - `in` is changed to return `true` or `false`. + + ```ruby + # version 3.0 + 0 in 1 #=> false + + # version 2.7 + 0 in 1 #=> raise NoMatchingPatternError + ``` + +- Find pattern is added. (experimental) + + ```ruby + case ["a", 1, "b", "c", 2, "d", "e", "f", 3] + in [*pre, String => x, String => y, *post] + p pre #=> ["a", 1] + p x #=> "b" + p y #=> "c" + p post #=> [2, "d", "e", "f", 3] + end + ``` + +- Endless method definition is added. + + ```ruby + def square(x) = x * x + ``` + +- `Hash#except` is now built-in. + + ```ruby + h = { a: 1, b: 2, c: 3 } + p h.except(:a) #=> {:b=>2, :c=>3} + ``` + +- Memory view is added as an experimental feature + + - This is a new C-API set to exchange a raw memory area, such as a numeric array or a bitmap image, between extension libraries. The extension libraries can share also the metadata of the memory area that consists of the shape, the element format, and so on. Using these kinds of metadata, the extension libraries can share even a multidimensional array appropriately. This feature is designed by referring to Python's buffer protocol. + +## Performance improvements + +- Pasting long code to IRB is 53 times faster than in the version bundled with Ruby 2.7.0. For example, the time required to paste [this sample code](https://gist.github.com/aycabta/30ab96334275bced5796f118c9220b0b) goes from 11.7 seconds to 0.22 seconds. + + + +- The `measure` command has been added to IRB. It allows simple execution time measurement. + + ``` + irb(main):001:0> 3 + => 3 + irb(main):002:0> measure + TIME is added. + => nil + irb(main):003:0> 3 + processing time: 0.000058s + => 3 + irb(main):004:0> measure :off + => nil + irb(main):005:0> 3 + => 3 + ``` + +## Other notable changes since 2.7 + +- Keyword arguments are separated from other arguments. + + - In principle, code that prints a warning on Ruby 2.7 won't work. See [this document](https://www.ruby-lang.org/en/news/2019/12/12/separation-of-positional-and-keyword-arguments-in-ruby-3-0/) for details. + - By the way, arguments forwarding now supports leading arguments. + + ```ruby + def method_missing(meth, ...) + send(:"do_#{ meth }", ...) + end + ``` + +- Pattern matching (`case`/`in`) is no longer experimental. + - See the [pattern matching documentation](https://docs.ruby-lang.org/en/3.0.0/doc/syntax/pattern_matching_rdoc.html) for details. +- The `$SAFE` feature was completely removed; now it is a normal global variable. +- The order of backtraces had been reversed with Ruby 2.5; this change has been reverted. Now backtraces behave like in Ruby 2.4: an error message and the line number where the exception occurs are printed first, and its callers are printed later. +- Some standard libraries are updated. + - RubyGems 3.2.3 + - Bundler 2.2.3 + - IRB 1.3.0 + - Reline 0.2.0 + - Psych 3.3.0 + - JSON 2.5.1 + - BigDecimal 3.0.0 + - CSV 3.1.9 + - Date 3.1.0 + - Digest 3.0.0 + - Fiddle 1.0.6 + - StringIO 3.0.0 + - StringScanner 3.0.0 + - etc. +- The following libraries are no longer bundled gems or standard libraries. + Install the corresponding gems to use these features. + - sdbm + - webrick + - net-telnet + - xmlrpc +- The following default gems are now bundled gems. + - rexml + - rss +- The following stdlib files are now default gems and are published on rubygems.org. + - English + - abbrev + - base64 + - drb + - debug + - erb + - find + - net-ftp + - net-http + - net-imap + - net-protocol + - open-uri + - optparse + - pp + - prettyprint + - resolv-replace + - resolv + - rinda + - set + - securerandom + - shellwords + - tempfile + - tmpdir + - time + - tsort + - un + - weakref + - digest + - io-nonblock + - io-wait + - nkf + - pathname + - syslog + - win32ole + +See [NEWS](https://github.com/ruby/ruby/blob/{{ release.tag }}/NEWS.md) +or [commit logs](https://github.com/ruby/ruby/compare/v2_7_0...{{ release.tag }}) +for more details. + +With those changes, [{{ release.stats.files_changed }} files changed, {{ release.stats.insertions }} insertions(+), {{ release.stats.deletions }} deletions(-)](https://github.com/ruby/ruby/compare/v2_7_0...{{ release.tag }}#file_bucket) +since Ruby 2.7.0! + +> Ruby3.0 is a milestone. The language is evolved, keeping compatibility. But it's not the end. Ruby will keep progressing, and become even greater. Stay tuned! --- Matz + +Merry Christmas, Happy Holidays, and enjoy programming with Ruby 3.0! + +## Download + +- <{{ release.url.gz }}> + + SIZE: {{ release.size.gz }} + SHA1: {{ release.sha1.gz }} + SHA256: {{ release.sha256.gz }} + SHA512: {{ release.sha512.gz }} + +- <{{ release.url.xz }}> + + SIZE: {{ release.size.xz }} + SHA1: {{ release.sha1.xz }} + SHA256: {{ release.sha256.xz }} + SHA512: {{ release.sha512.xz }} + +- <{{ release.url.zip }}> + + SIZE: {{ release.size.zip }} + SHA1: {{ release.sha1.zip }} + SHA256: {{ release.sha256.zip }} + SHA512: {{ release.sha512.zip }} + +## What is Ruby + +Ruby was first developed by Matz (Yukihiro Matsumoto) in 1993 +and is now developed as Open Source. It runs on multiple platforms +and is used all over the world especially for web development. From 31dc79ed1b0fe1b38bc185e9ca361c479451e382 Mon Sep 17 00:00:00 2001 From: Chatpitre Date: Fri, 26 Mar 2021 15:54:36 +0100 Subject: [PATCH 0007/1090] avancement dans la traduction --- ...2020-12-08-ruby-3-0-0-preview2-released.md | 21 ++++++++++--------- .../2020-12-20-ruby-3-0-0-rc1-released.md | 8 ++++--- 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/fr/news/_posts/2020-12-08-ruby-3-0-0-preview2-released.md b/fr/news/_posts/2020-12-08-ruby-3-0-0-preview2-released.md index 508273d3bd..5a0699f025 100644 --- a/fr/news/_posts/2020-12-08-ruby-3-0-0-preview2-released.md +++ b/fr/news/_posts/2020-12-08-ruby-3-0-0-preview2-released.md @@ -140,7 +140,7 @@ La spécification et l'implémintation ne sont pas matures et peuvent changer da The specification and implementation are not matured and may be changed in the future, so this feature is marked as experimental and show the "experimental feature" warning when the first `Ractor.new`. -Le petit programme suivant calcul `n.prime?` (`n` est un entier relativement grand) en parallele avec deux ractors. Vous pouvez vérifier que le programme est deux fois plus rapide que celui séquentiel sur le calcul parralele. +Le bout de code suivant calcul `n.prime?` (`n` est un entier relativement grand) en parallele avec deux ractors. Vous pouvez vérifier que le programme est deux fois plus rapide que celui séquentiel sur le calcul parralele. The following small program calculates `n.prime?` (`n` is relatively a big integer) in parallel with two ractors. You will confirm that the program execution is about x2 times faster compared to the sequential program on the parallel computer. @@ -329,18 +329,17 @@ end - tsort - weakref -See [NEWS](https://github.com/ruby/ruby/blob/v3_0_0_preview2/NEWS.md) -or [commit logs](https://github.com/ruby/ruby/compare/v2_7_0...v3_0_0_preview2) -for more details. +Voir [NEWS](https://github.com/ruby/ruby/blob/v3_0_0_preview2/NEWS.md) +ou les [logs de commit](https://github.com/ruby/ruby/compare/v2_7_0...v3_0_0_preview2) pour plus de détails. {% assign release = site.data.releases | where: "version", "3.0.0-preview2" | first %} -With those changes, [{{ release.stats.files_changed }} files changed, {{ release.stats.insertions }} insertions(+), {{ release.stats.deletions }} deletions(-)](https://github.com/ruby/ruby/compare/v2_7_0...v3_0_0) -since Ruby 2.7.0! +Avec ces changements, [{{ release.stats.files_changed }} fichiers changés, {{ release.stats.insertions }} insertions(+), {{ release.stats.deletions }} suppressions(-)](https://github.com/ruby/ruby/compare/v2_7_0...v3_0_0) +depuis Ruby 2.7.0! -Please try Ruby 3.0.0-preview2, and give us any feedback! +Essayez Ruby 3.0.0-preview2 s'il vous plait et faites nous des retours ! -## Download +## Téléchargement - <{{ release.url.gz }}> @@ -363,8 +362,10 @@ Please try Ruby 3.0.0-preview2, and give us any feedback! SHA256: {{ release.sha256.zip }} SHA512: {{ release.sha512.zip }} -## What is Ruby +## Ruby, c'est quoi ? + +Ruby a d'abord été developpé par Matz (Yukihiro Matsumoto) en 1993, mais est désormais Open Source. +Ruby fonctionne sur de multiple plateformes et est utilisé à travers le monde notamment dans le développement web. -Ruby was first developed by Matz (Yukihiro Matsumoto) in 1993, and is now developed as Open Source. It runs on multiple platforms and is used all over the world especially for web development. diff --git a/fr/news/_posts/2020-12-20-ruby-3-0-0-rc1-released.md b/fr/news/_posts/2020-12-20-ruby-3-0-0-rc1-released.md index ac3f7b0c77..d6f737590c 100644 --- a/fr/news/_posts/2020-12-20-ruby-3-0-0-rc1-released.md +++ b/fr/news/_posts/2020-12-20-ruby-3-0-0-rc1-released.md @@ -292,7 +292,7 @@ since Ruby 2.7.0! Please try Ruby 3.0.0-rc1, and give us any feedback! -## Download +## Téléchargement - <{{ release.url.gz }}> @@ -315,8 +315,10 @@ Please try Ruby 3.0.0-rc1, and give us any feedback! SHA256: {{ release.sha256.zip }} SHA512: {{ release.sha512.zip }} -## What is Ruby +## Ruby, c'est quoi ? + +Ruby a d'abord été developpé par Matz (Yukihiro Matsumoto) en 1993, mais est désormais Open Source. +Ruby fonctionne sur de multiple plateformes et est utilisé à travers le monde notamment dans le développement web. -Ruby was first developed by Matz (Yukihiro Matsumoto) in 1993, and is now developed as Open Source. It runs on multiple platforms and is used all over the world especially for web development. From 43cbf8082e4d35269cfdcb5ef5b52ea71f8f673f Mon Sep 17 00:00:00 2001 From: Chatpitre Date: Fri, 26 Mar 2021 20:35:18 +0100 Subject: [PATCH 0008/1090] avancement de la traduction --- .../_posts/2020-12-08-ruby-3-0-0-preview2-released.md | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/fr/news/_posts/2020-12-08-ruby-3-0-0-preview2-released.md b/fr/news/_posts/2020-12-08-ruby-3-0-0-preview2-released.md index 5a0699f025..bd89924dd8 100644 --- a/fr/news/_posts/2020-12-08-ruby-3-0-0-preview2-released.md +++ b/fr/news/_posts/2020-12-08-ruby-3-0-0-preview2-released.md @@ -75,6 +75,8 @@ Cela lit du code Ruby non annoté, analyse quelles méthodes sont définis, comm It reads plain (non-type-annotated) Ruby code, analyzes what methods are defined and how they are used, and generates a prototype of type signature in RBS format. +Voici un exemple simple de TypeProf. + Here is a simple demo of TypeProf. An example input: @@ -114,7 +116,7 @@ Vous pouvez aussi [essayer TypeProf en ligne](https://mame.github.io/typeprof-pl You can also [try TypeProf online](https://mame.github.io/typeprof-playground/#rb=%23+test.rb%0Aclass+User%0A++def+initialize%28name%3A%2C+age%3A%29%0A++++%40name%2C+%40age+%3D+name%2C+age%0A++end%0A++%0A++attr_reader+%3Aname%2C+%3Aage%0Aend%0A%0AUser.new%28name%3A+%22John%22%2C+age%3A+20%29&rbs=). (It runs TypeProf on the server side, so sorry if it is out!) -Voir [la documentation](https://github.com/ruby/typeprof/blob/master/doc/doc.md) and [les demos](https://github.com/ruby/typeprof/blob/master/doc/demo.md) pour plus de détails. +Voir [la documentation](https://github.com/ruby/typeprof/blob/master/doc/doc.md) et [les demos](https://github.com/ruby/typeprof/blob/master/doc/demo.md) pour plus de détails. See [the documentation](https://github.com/ruby/typeprof/blob/master/doc/doc.md) and [demos](https://github.com/ruby/typeprof/blob/master/doc/demo.md) for details. @@ -228,15 +230,17 @@ end p post #=> [2, "d", "e", "f", 3] end ``` -- La définition sans le mot clé `end`. +- La définition de méthode sans le mot clé `end`. ```ruby def square(x) = x * x ``` - `Hash#except` est désormais intégré. + ```ruby h = { a: 1, b: 2, c: 3 } p h.except(:a) #=> {:b=>2, :c=>3} ``` + - Memory view est ajoutée en tant que fonctionnalité experimentale - C'est un nouvel ensemble d'API C pour échanger une zone mémoire brute, comme un tableau de nombre ou une image bitmap, entre des bibliotheques d'extension. Les bibliotheques d'extension permettent aussi de partager les méta données de la zone mémoire qui est constituée de la forme, du format de l'élément, etc. En utilisant ce types de métadata, les librairies d'extenstion peuvent partager meme des tableau multidimensionnel de facon approprié. Cette fonctionnalité est concu en se referrant au protocol tampon de python. @@ -278,7 +282,7 @@ end - Les gems suivantes sont désormais empaquetées avec Ruby. - rexml - rss -- Les fichiers stdlib suivants sont désormais des gems et sont publiées sur rubygems.org. The following stdlib files are now default gems and are published on rubygems.org. +- Les fichiers stdlib suivants sont désormais des gems et sont publiées sur rubygems.org. - Keyword arguments are separated from other arguments. - In principle, code that prints a warning on Ruby 2.7 won't work. See the [document](https://www.ruby-lang.org/en/news/2019/12/12/separation-of-positional-and-keyword-arguments-in-ruby-3-0/) in detail. From d1c3a784adef424c62eb929b29f9373e7f0510ba Mon Sep 17 00:00:00 2001 From: Chatpitre Date: Fri, 26 Mar 2021 20:35:46 +0100 Subject: [PATCH 0009/1090] avancement traduction --- .../2020-12-20-ruby-3-0-0-rc1-released.md | 160 +++++++++++++++++- 1 file changed, 152 insertions(+), 8 deletions(-) diff --git a/fr/news/_posts/2020-12-20-ruby-3-0-0-rc1-released.md b/fr/news/_posts/2020-12-20-ruby-3-0-0-rc1-released.md index d6f737590c..7bf295f62c 100644 --- a/fr/news/_posts/2020-12-20-ruby-3-0-0-rc1-released.md +++ b/fr/news/_posts/2020-12-20-ruby-3-0-0-rc1-released.md @@ -7,14 +7,31 @@ date: 2020-12-20 00:00:00 +0000 lang: en --- +Nous sommes heureux de vous annoncer la sortie de Ruby 3.0.0-rc1. + +Cela introduit un certain nombre de nouvelles fonctionnalités et d'amélioration de performance. + We are pleased to announce the release of Ruby 3.0.0-rc1. It introduces a number of new features and performance improvements. +## Analyse statique + ## Static Analysis ### RBS +RBS est un langage qui décrit les types des programmes Ruby. + +Les vérifications de type incluent TypeProf et d'autres outils supportant RBS qui comprennent les programmes Ruby bien mieux avec les définitions RBS. + +Vous pouvez écrire directement la définition des classes et modules : les méthodes définis dans la classe, les variables d'instances et leurs types et les relations d'héritage/mix-in. + +Le but de RBS est de supporter les patterns communs dans les programmes Ruby et de permettre d'écrire des types avancés incluant les unions de types, la surcharge de méthode et les génériques. Cela supporte aussi le duck typing avec _interface types_. + +Ruby 3.0 arrive avec la gem `rbs`, qui inclue l'analyse et le traitement des définitions de type écrit en RBS. +Le code ci-dessous est un petit exemple de RBS avec une des définitions de classe, module et constante. + RBS is a language to describe the types of Ruby programs. Type checkers including TypeProf and other tools supporting RBS will understand Ruby programs much better with RBS definitions. @@ -40,10 +57,22 @@ module ChatApp end ``` +Voir le [README de la gem rbs](https://github.com/ruby/rbs) pour plus de détails + See [README of rbs gem](https://github.com/ruby/rbs) for more detail. ### TypeProf +TypeProf est un outil d'analyse de type compris dans Ruby. + +Actuellement, TypeProf permet une sorte d'inférence de type. + +Cela lit du code Ruby non annoté, analyse quelles méthodes sont définis, comment elles sont utilités et générenet un prototype de signature de type au format RBS. + +Voici un exemple simple de TypeProf. + +Un exemple d'entrée : + TypeProf is a type analysis tool bundled in the Ruby package. Currently, TypeProf serves as a kind of type inference. @@ -65,6 +94,8 @@ end User.new(name: "John", age: 20) ``` +Un exemple de sortie : + An example output: ``` @@ -77,16 +108,34 @@ class User end ``` +Vous pouvez lancer TypeProf en sauvegadant l'entrée dans un fichier "test.rb" et en appelant la commande "typeprof test.rb". + You can run TypeProf by saving the input as "test.rb" and invoke a command called "typeprof test.rb". +Vous pouvez aussi [essayer TypeProf en ligne](https://mame.github.io/typeprof-playground/#rb=%23+test.rb%0Aclass+User%0A++def+initialize%28name%3A%2C+age%3A%29%0A++++%40name%2C+%40age+%3D+name%2C+age%0A++end%0A++%0A++attr_reader+%3Aname%2C+%3Aage%0Aend%0A%0AUser.new%28name%3A+%22John%22%2C+age%3A+20%29&rbs=). (Cela lance TypeProf coté serveur, donc désolé si c'est) + You can also [try TypeProf online](https://mame.github.io/typeprof-playground/#rb=%23+test.rb%0Aclass+User%0A++def+initialize%28name%3A%2C+age%3A%29%0A++++%40name%2C+%40age+%3D+name%2C+age%0A++end%0A++%0A++attr_reader+%3Aname%2C+%3Aage%0Aend%0A%0AUser.new%28name%3A+%22John%22%2C+age%3A+20%29&rbs=). (It runs TypeProf on the server side, so sorry if it is out!) +Voir [la documentation](https://github.com/ruby/typeprof/blob/master/doc/doc.md) et [les demos](https://github.com/ruby/typeprof/blob/master/doc/demo.md) pour plus de détails. + See [the documentation](https://github.com/ruby/typeprof/blob/master/doc/doc.md) and [demos](https://github.com/ruby/typeprof/blob/master/doc/demo.md) for details. +TypeProf est expérimental et n'est pas encore mature. Seulement un sous ensemble du langage Ruby est supporté et la détection des erreurs de typage est limitée. Cela évolue rapidement tout de même afin d'améliorer la couvertures des fonctionnalités du langage, l'analyse de performance et la maniabilité. Tout retour est le bienvenue. + TypeProf is experimental and not so mature yet; only a subset of the Ruby language is supported, and the detection of type errors is limited. But it is still growing rapidly to improve the coverage of language features, the analysis performance, and usability. Any feedback is very welcome. ## Ractor (experimental) +Ractor est un modèle d'acteur permettant une abstraction pour la concurrence. Il fournit un outil permettant l'execution thread-safe de code. + +Vous pouvez créer plusieurs ractors et les lancer en parallele. Ractor vous permet de créer des programmes thread-safe car les reactors ne partage pas des objets normaux. La communication entre ractors se fait par passage de message. + +Afin de limiter le partage d'objet, Ractor introduit plusieurs restriction sur la syntaxe de Ruby (sans plusieurs ractors, il n'y a pas de restriction). + +La spécification et l'implémintation ne sont pas matures et peuvent changer dans le futur. Par conséquent cette fonctionnalité est marquée commme experimentale et montre l'avertissement "experimental feature" au premier `Ractor.new`. + +Le bout de code suivant calcul `n.prime?` (`n` est un entier relativement grand) en parallele avec deux ractors. Vous pouvez vérifier que le programme est deux fois plus rapide que celui séquentiel sur le calcul parralele. + Ractor is an Actor-model like concurrent abstraction designed to provide a parallel execution feature without thread-safety concerns. You can make multiple ractors and you can run them in parallel. Ractor enables you to make thread-safe parallel programs because ractors can not share normal objects. Communication between ractors are supported by message passing. @@ -114,12 +163,18 @@ p r1.take #=> true p r2.take #=> true ``` +Voir [doc/ractor.md](https://github.com/ruby/ruby/blob/master/doc/ractor.md) pour plus de details. + See [doc/ractor.md](https://github.com/ruby/ruby/blob/master/doc/ractor.md) for more details. ## Fiber Scheduler +`Fiber#scheduler` est introduit pour intercepter des opérations de blocage. Cela permet une concurrence légère sans changer le code existant. Voir ["Don't Wait For Me, Scalable Concurrency for Ruby 3"](https://www.youtube.com/watch?v=Y29SSOS4UOc) pour avoir un apercu du fonctionnement. + `Fiber#scheduler` is introduced for intercepting blocking operations. This allows for light-weight concurrency without changing existing code. Watch ["Don't Wait For Me, Scalable Concurrency for Ruby 3"](https://www.youtube.com/watch?v=Y29SSOS4UOc) for an overview of how it works. +Les classes et méthodes prises en charge: + Currently supported classes/methods: - `Mutex#lock`, `Mutex#unlock`, `Mutex#sleep` @@ -131,6 +186,13 @@ Currently supported classes/methods: - `IO#wait`, `IO#read`, `IO#write` and related methods (e.g. `#wait_readable`, `#gets`, `#puts` and so on). - `IO#select` is _not supported_. +Cet exemple de code permet de faire plusieurs requetes HTTP de facon concurrente. +(Expliquer la gem Async avec des liens). Cet exemple de code permet de faire plusieurs requetes HTTP de facon concurrente. +(Expler ceci:) + +1. async est une gemme externe +2. async utilise cette nouvelle fonctionnalité + (Explain Async gem with links). This example program will perform several HTTP requests concurrently: (Explain this:) @@ -151,10 +213,14 @@ Async do end ``` +## Autres ajouts notables + ## Other Notable New Features +- Le filtrage par motif en une ligne est changé (experimental). - One-line pattern matching is redesigned. (experimental) + - `=>` est ajouté. Il peut être utilisé comme une affectation à droite. - `=>` is added. It can be used as like rightward assignment. ```ruby @@ -165,6 +231,7 @@ end p b #=> 0 ``` + - `in` est changé pour retourner `true` ou `false`. - `in` is changed to return `true` or `false`. ```ruby @@ -175,6 +242,7 @@ end 0 in 1 #=> raise NoMatchingPatternError ``` +- Le pattern Find pattern est ajouté. (experimental) - Find pattern is added. (experimental) ```ruby @@ -187,30 +255,107 @@ end end ``` -- Endless method definition is added. +- La définition de méthode sans le mot clé `end`. ```ruby def square(x) = x * x ``` -- `Hash#except` is now built-in. +- `Hash#except` est désormais intégré. ```ruby h = { a: 1, b: 2, c: 3 } p h.except(:a) #=> {:b=>2, :c=>3} ``` +- Memory view est ajoutée en tant que fonctionnalité experimentale + + - C'est un nouvel ensemble d'API C pour échanger une zone mémoire brute, comme un tableau de nombre ou une image bitmap, entre des bibliotheques d'extension. Les bibliotheques d'extension permettent aussi de partager les méta données de la zone mémoire qui est constituée de la forme, du format de l'élément, etc. En utilisant ce types de métadata, les librairies d'extenstion peuvent partager meme des tableau multidimensionnel de facon approprié. Cette fonctionnalité est concu en se referrant au protocol tampon de python. + - Memory view is added as an experimental feature - This is a new C-API set to exchange a raw memory area, such as a numeric array and a bitmap image, between extension libraries. The extension libraries can share also the metadata of the memory area that consists of the shape, the element format, and so on. Using these kinds of metadata, the extension libraries can share even a multidimensional array appropriately. This feature is designed by referring to Python's buffer protocol. +## Amélioration des performances + ## Performance improvements +- Plusieurs améliorations sont implémentées dans MJIT. Voir NEWS pour les details. +- Coller du code dans IRB est 53 fois plus rapide qu'en Ruby 2.7.0. Par exemple le temps nécessaire pour coller [cet exemple de code](https://gist.github.com/aycabta/30ab96334275bced5796f118c9220b0b) passe de 11.7 secondes à 0.22 secondes. + - Many improvements were implemented in MJIT. See NEWS in detail. - Pasting long code to IRB is 53 times faster than bundled with Ruby 2.7.0. For example, the time required to paste [this sample code](https://gist.github.com/aycabta/30ab96334275bced5796f118c9220b0b) goes from 11.7 seconds to 0.22 seconds. +## Autres changements notables depuis la version 2.7 + ## Other notable changes since 2.7 +- Les arguments de mot clé sont séparé des autres arguments. + - En principe, le code qui affiche un avertissement dans la version 2.7 de ruby ne fonctionnera pas. Voir le [document](https://www.ruby-lang.org/en/news/2019/12/12/separation-of-positional-and-keyword-arguments-in-ruby-3-0/) pour plus de détails. + - La transmission d'arguments prend en charge les arguments de l'en-tête. + ```ruby + def method_missing(meth, ...) + send(:"do_#{ meth }", ...) + end + ``` +- La fonctionnalité `$SAFE` a été completement supprimée. C'est désormais une variable globale. +- L'ordre de la backtrace a été inversé depuis la version 2.5 de Ruby, mais cela a été remis comme avant. Cela se comporte comme la version 2.4 de Ruby. Le message d'erreur et le numéro de ligne ou l'exception apparait sont affichés en premiers. Les appelants sont affichés apres. +- Plusieurs bibliothèques standard ont été mises à jour. + - RubyGems 3.2.2 + - Bundler 2.2.2 + - IRB 1.2.6 + - Reline 0.1.5 + - Psych 3.2.1 + - JSON 2.4.1 + - BigDecimal 3.0.0 + - CSV 3.1.9 + - Digest 3.0.0 + - Fiddle 1.0.4 + - StringIO 3.0.0 + - StringScanner 3.0.0 +- Les librairies suivantes ne sont plus empaquetées. Il faut installer jes gems correspondantes pour utiliser leurs fonctionnalitées. + - net-telnet + - xmlrpc +- Les gems suivantes sont désormais empaquetées avec Ruby. + - rexml + - rss +- Les fichiers stdlib suivants sont désormais des gems et sont publiées sur rubygems.org. +- English + + - abbrev + - base64 + - drb + - debug + - erb + - find + - net-ftp + - net-http + - net-imap + - net-protocol + - open-uri + - optparse + - pp + - prettyprint + - resolv-replace + - resolv + - rinda + - set + - securerandom + - shellwords + - tempfile + - tmpdir + - time + - tsort + - un + - weakref + - digest + - io-nonblock + - io-wait + - nkf + - pathname + - syslog + - win32ole + - Keyword arguments are separated from other arguments. - In principle, code that prints a warning on Ruby 2.7 won't work. See the [document](https://www.ruby-lang.org/en/news/2019/12/12/separation-of-positional-and-keyword-arguments-in-ruby-3-0/) in detail. @@ -281,16 +426,15 @@ end - syslog - win32ole -See [NEWS](https://github.com/ruby/ruby/blob/v3_0_0_rc1/NEWS.md) -or [commit logs](https://github.com/ruby/ruby/compare/v2_7_0...v3_0_0_rc1) -for more details. +Voir [NEWS](https://github.com/ruby/ruby/blob/v3_0_0_rc1/NEWS.md) +ou les [logs de commit](https://github.com/ruby/ruby/compare/v2_7_0...v3_0_0_rc1) pour plus de détails {% assign release = site.data.releases | where: "version", "3.0.0-rc1" | first %} -With those changes, [{{ release.stats.files_changed }} files changed, {{ release.stats.insertions }} insertions(+), {{ release.stats.deletions }} deletions(-)](https://github.com/ruby/ruby/compare/v2_7_0...v3_0_0) -since Ruby 2.7.0! +Avec ces changements, [{{ release.stats.files_changed }} fichiers changés, {{ release.stats.insertions }} insertions(+), {{ release.stats.deletions }} suppressions(-)](https://github.com/ruby/ruby/compare/v2_7_0...v3_0_0) +depuis Ruby 2.7.0! -Please try Ruby 3.0.0-rc1, and give us any feedback! +Essayez Ruby 3.0.0-rc1 s'il vous plait et faites nous des retours ! ## Téléchargement From 0fe1eb62efaf252dcc9b3dac8a993c6eba70457e Mon Sep 17 00:00:00 2001 From: Chatpitre Date: Fri, 26 Mar 2021 22:33:46 +0100 Subject: [PATCH 0010/1090] =?UTF-8?q?traduction=20de=20la=202.7.2=20OK=20d?= =?UTF-8?q?=C3=A9but=20de=20la=20mise=20au=20propre=20de=20la=203.0.0=20pr?= =?UTF-8?q?ev2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../_posts/2020-10-02-ruby-2-7-2-released.md | 24 ++++--------- ...2020-12-08-ruby-3-0-0-preview2-released.md | 36 +++++-------------- 2 files changed, 15 insertions(+), 45 deletions(-) diff --git a/fr/news/_posts/2020-10-02-ruby-2-7-2-released.md b/fr/news/_posts/2020-10-02-ruby-2-7-2-released.md index 08f8f9b2b0..eae16113bf 100644 --- a/fr/news/_posts/2020-10-02-ruby-2-7-2-released.md +++ b/fr/news/_posts/2020-10-02-ruby-2-7-2-released.md @@ -9,26 +9,16 @@ lang: en Ruby 2.7.2 est désormais disponible. -Cette version contient des incompatiblitées intentionnelles. Les avertissement de des déprécation sont désactivé par défaut dans la 2.7.2 et supérieur. Il est possible d'activer les avertissements en spécifiant l'option -w ou -W:deprecated en ligne de commande. Veuillez regarder les sujets ci-dessous pour plus de détails. +Cette version contient des incompatibilités intentionnelles. Les avertissements concernant les déprécations sont désactivés par défaut dans la 2.7.2 et supérieur. Il est possible d'activer les avertissements en spécifiant l'option -w ou -W:deprecated en ligne de commande. Veuillez regarder les tickets ci-dessous pour plus de détails. -This release contains intentional incompatibility. Deprecation warnings are off by default on 2.7.2 and later. -You can turn on deprecation warnings by specifying the -w or -W:deprecated option at the command-line. -Please check the topics below for details. +- [Ticket #17000 2.7.2 turns off deprecation warnings by default](https://bugs.ruby-lang.org/issues/17000) +- [Ticket #16345 Don’t emit deprecation warnings by default.](https://bugs.ruby-lang.org/issues/16345) -- [Ticket #17000](https://bugs.ruby-lang.org/issues/17000) -- [Ticket #16345](https://bugs.ruby-lang.org/issues/16345) - -- [Feature #17000 2.7.2 turns off deprecation warnings by default](https://bugs.ruby-lang.org/issues/17000) -- [Feature #16345 Don't emit deprecation warnings by default.](https://bugs.ruby-lang.org/issues/16345) - -Cette version contient la nouvelle version de webrick avec une correction conscernant la sécurité comme décrit dans l'article suivant. - -This release contains the new version of webrick with a security fix described in the article. +Cette version contient la nouvelle version de webrick avec une correction concernant la sécurité comme décrit dans l'article suivant. - [CVE-2020-25613: Potential HTTP Request Smuggling Vulnerability in WEBrick](/en/news/2020/09/29/http-request-smuggling-cve-2020-25613/) -Veuillez lire les autres changement dans les logs de commits. -See the [commit logs](https://github.com/ruby/ruby/compare/v2_7_1...v2_7_2) for other changes. +Veuillez lire les autres changement dans les [logs de commit](https://github.com/ruby/ruby/compare/v2_7_1...v2_7_2). ## Téléchargements @@ -64,6 +54,4 @@ See the [commit logs](https://github.com/ruby/ruby/compare/v2_7_1...v2_7_2) for ## Commentaire de la versionm -Merci aux nombreux contributeurs, developpeurs et utilisateurs qui en remontant des rapports de bugs et contribuant ont rendu cette version possible. - -Thanks to the many committers, developers and users who provided bug reports and contributions that made this release possible. +Merci aux nombreux contributeurs, développeurs et utilisateurs qui, en contribuant et en remontant des rapports de bugs, ont rendu cette version possible. diff --git a/fr/news/_posts/2020-12-08-ruby-3-0-0-preview2-released.md b/fr/news/_posts/2020-12-08-ruby-3-0-0-preview2-released.md index bd89924dd8..56affcd18f 100644 --- a/fr/news/_posts/2020-12-08-ruby-3-0-0-preview2-released.md +++ b/fr/news/_posts/2020-12-08-ruby-3-0-0-preview2-released.md @@ -9,39 +9,23 @@ lang: en Nous sommes heureux de vous annoncer la sortie de Ruby 3.0.0-preview2. -Cela introduit un certain nombre de nouvelles fonctionnalités et d'amélioration de performance. - -We are pleased to announce the release of Ruby 3.0.0-preview2. - -It introduces a number of new features and performance improvements. +Cela introduit un certain nombre de nouvelles fonctionnalités et d'améliorations de performance. ## Analyse statique -## Static Analysis - ### RBS -RBS est un langage qui décrit les types des programmes Ruby. - -RBS is a language to describe the types of Ruby programs. +RBS est un langage qui décrit les types de programmes Ruby. -Les vérifications de type incluent TypeProf et d'autres outils supportant RBS qui comprennent les programmes Ruby bien mieux avec les définitions RBS. +Les vérificateurs de type, y compris TypeProf et d'autres outils prenant en charge RBS, comprendront mieux les programmes Ruby avec des définitions RBS. -Type checkers including TypeProf and other tools supporting RBS will understand Ruby programs much better with RBS definitions. +Vous pouvez écrire la définition des classes et des modules: les méthodes qui sont définies dans la classe, les variables d'instance et leurs types, et les relations d'héritage / mix-in. -Vous pouvez écrire directement la définition des classes et modules : les méthodes définis dans la classe, les variables d'instances et leurs types et les relations d'héritage/mix-in. +Le but de RBS est de prendre en charge les modèles couramment observés dans les programmes Ruby et de vous permettre d'écrire des types avancés, notamment les unions de type, les surcharges de méthode et les génériques. Il prend également en charge le duck typing avec _interface types_. -You can write down the definition of classes and modules: methods defined in the class, instance variables and their types, and inheritance/mix-in relations. +Ruby 3.0 arrive avec la gemme 'rbs', qui inclue l'analyse et le traitement des définitions de type écrites en RBS. -Le but de RBS est de supporter les patterns communs dans les programmes Ruby et de permettre d'écrire des types avancés incluant les unions de types, la surcharge de méthode et les génériques. Cela supporte aussi le duck typing avec _interface types_. - -The goal of RBS is to support commonly seen patterns in Ruby programs and it allows writing advanced types including union types, method overloading, and generics. It also supports duck typing with _interface types_. - -Ruby 3.0 arrive avec la gem `rbs`, qui inclue l'analyse et le traitement des définitions de type écrit en RBS. -Le code ci-dessous est un petit exemple de RBS avec une des définitions de classe, module et constante. - -Ruby 3.0 ships with `rbs` gem, which allows parsing and processing type definitions written in RBS. -The following is a small example of RBS with class, module, and constant definitions. +Le code ci-dessous est un petit exemple de RBS une classe, un module et des définitions de constantes. ```rbs module ChatApp @@ -57,9 +41,7 @@ module ChatApp end ``` -Voir le [README de la gem rbs](https://github.com/ruby/rbs) pour plus de détails. - -See [README of rbs gem](https://github.com/ruby/rbs) for more detail. +Voir le [README de la gemme rbs](https://github.com/ruby/rbs) pour plus de détails. ### TypeProf @@ -112,7 +94,7 @@ Vous pouvez lancer TypeProf en sauvegadant l'entrée dans un fichier "test.rb" e You can run TypeProf by saving the input as "test.rb" and invoke a command called "typeprof test.rb". -Vous pouvez aussi [essayer TypeProf en ligne](https://mame.github.io/typeprof-playground/#rb=%23+test.rb%0Aclass+User%0A++def+initialize%28name%3A%2C+age%3A%29%0A++++%40name%2C+%40age+%3D+name%2C+age%0A++end%0A++%0A++attr_reader+%3Aname%2C+%3Aage%0Aend%0A%0AUser.new%28name%3A+%22John%22%2C+age%3A+20%29&rbs=). (Cela lance TypeProf coté serveur, donc désolé si c'est) +Vous pouvez aussi [essayer TypeProf en ligne](https://mame.github.io/typeprof-playground/#rb=%23+test.rb%0Aclass+User%0A++def+initialize%28name%3A%2C+age%3A%29%0A++++%40name%2C+%40age+%3D+name%2C+age%0A++end%0A++%0A++attr_reader+%3Aname%2C+%3Aage%0Aend%0A%0AUser.new%28name%3A+%22John%22%2C+age%3A+20%29&rbs=). (Cela lance TypeProf coté serveur, donc désolé si cela ne fonctionne pas !) You can also [try TypeProf online](https://mame.github.io/typeprof-playground/#rb=%23+test.rb%0Aclass+User%0A++def+initialize%28name%3A%2C+age%3A%29%0A++++%40name%2C+%40age+%3D+name%2C+age%0A++end%0A++%0A++attr_reader+%3Aname%2C+%3Aage%0Aend%0A%0AUser.new%28name%3A+%22John%22%2C+age%3A+20%29&rbs=). (It runs TypeProf on the server side, so sorry if it is out!) From 69cc626374b8e279eeefc3b8199aea9f84e8be69 Mon Sep 17 00:00:00 2001 From: Chatpitre Date: Sat, 27 Mar 2021 08:45:43 +0100 Subject: [PATCH 0011/1090] prev2 et rc1 ok --- .../_posts/2020-10-02-ruby-2-7-2-released.md | 2 +- ...2020-12-08-ruby-3-0-0-preview2-released.md | 139 +++-------- .../2020-12-20-ruby-3-0-0-rc1-released.md | 236 ++++-------------- 3 files changed, 79 insertions(+), 298 deletions(-) diff --git a/fr/news/_posts/2020-10-02-ruby-2-7-2-released.md b/fr/news/_posts/2020-10-02-ruby-2-7-2-released.md index eae16113bf..92ab43040b 100644 --- a/fr/news/_posts/2020-10-02-ruby-2-7-2-released.md +++ b/fr/news/_posts/2020-10-02-ruby-2-7-2-released.md @@ -4,7 +4,7 @@ title: "Ruby 2.7.2 est disponible" author: "nagachika" translator: "chatpitre" date: 2020-10-02 11:00:00 +0000 -lang: en +lang: fr --- Ruby 2.7.2 est désormais disponible. diff --git a/fr/news/_posts/2020-12-08-ruby-3-0-0-preview2-released.md b/fr/news/_posts/2020-12-08-ruby-3-0-0-preview2-released.md index 56affcd18f..c62316b800 100644 --- a/fr/news/_posts/2020-12-08-ruby-3-0-0-preview2-released.md +++ b/fr/news/_posts/2020-12-08-ruby-3-0-0-preview2-released.md @@ -4,7 +4,7 @@ title: "Ruby 3.0.0 Preview 2 est disponible" author: "naruse" translator: "chatpitre" date: 2020-12-08 00:00:00 +0000 -lang: en +lang: fr --- Nous sommes heureux de vous annoncer la sortie de Ruby 3.0.0-preview2. @@ -45,23 +45,13 @@ Voir le [README de la gemme rbs](https://github.com/ruby/rbs) pour plus de déta ### TypeProf -TypeProf est un outil d'analyse de type compris dans Ruby. - -TypeProf is a type analysis tool bundled in the Ruby package. +TypeProf est un outil d'analyse de type inclus dans Ruby. Actuellement, TypeProf permet une sorte d'inférence de type. -Currently, TypeProf serves as a kind of type inference. - -Cela lit du code Ruby non annoté, analyse quelles méthodes sont définis, comment elles sont utilités et générenet un prototype de signature de type au format RBS. - -It reads plain (non-type-annotated) Ruby code, analyzes what methods are defined and how they are used, and generates a prototype of type signature in RBS format. - -Voici un exemple simple de TypeProf. - -Here is a simple demo of TypeProf. +Il lit du code Ruby sans annotation de type, analyse quelles méthodes sont définies, comment elles sont utilisées et génère un prototype de la signature de type au format RBS. -An example input: +Voici une simple démo de TypeProf. Un exemple d'entrée : @@ -78,8 +68,6 @@ User.new(name: "John", age: 20) Un exemple de sortie : -An example output: - ``` $ typeprof test.rb # Classes @@ -90,43 +78,25 @@ class User end ``` -Vous pouvez lancer TypeProf en sauvegadant l'entrée dans un fichier "test.rb" et en appelant la commande "typeprof test.rb". - -You can run TypeProf by saving the input as "test.rb" and invoke a command called "typeprof test.rb". +Vous pouvez lancer TypeProf en sauvegadant le code dans un fichier "test.rb" et en appelant la commande "typeprof test.rb". Vous pouvez aussi [essayer TypeProf en ligne](https://mame.github.io/typeprof-playground/#rb=%23+test.rb%0Aclass+User%0A++def+initialize%28name%3A%2C+age%3A%29%0A++++%40name%2C+%40age+%3D+name%2C+age%0A++end%0A++%0A++attr_reader+%3Aname%2C+%3Aage%0Aend%0A%0AUser.new%28name%3A+%22John%22%2C+age%3A+20%29&rbs=). (Cela lance TypeProf coté serveur, donc désolé si cela ne fonctionne pas !) -You can also [try TypeProf online](https://mame.github.io/typeprof-playground/#rb=%23+test.rb%0Aclass+User%0A++def+initialize%28name%3A%2C+age%3A%29%0A++++%40name%2C+%40age+%3D+name%2C+age%0A++end%0A++%0A++attr_reader+%3Aname%2C+%3Aage%0Aend%0A%0AUser.new%28name%3A+%22John%22%2C+age%3A+20%29&rbs=). (It runs TypeProf on the server side, so sorry if it is out!) - -Voir [la documentation](https://github.com/ruby/typeprof/blob/master/doc/doc.md) et [les demos](https://github.com/ruby/typeprof/blob/master/doc/demo.md) pour plus de détails. - -See [the documentation](https://github.com/ruby/typeprof/blob/master/doc/doc.md) and [demos](https://github.com/ruby/typeprof/blob/master/doc/demo.md) for details. - -TypeProf est expérimental et n'est pas encore mature. Seulement un sous ensemble du langage Ruby est supporté et la détection des erreurs de typage est limitée. Cela évolue rapidement tout de même afin d'améliorer la couvertures des fonctionnalités du langage, l'analyse de performance et la maniabilité. Tout retour est le bienvenue. +Voir [la documentation](https://github.com/ruby/typeprof/blob/master/doc/doc.md) et [les démos](https://github.com/ruby/typeprof/blob/master/doc/demo.md) pour plus de détails. -TypeProf is experimental and not so mature yet; only a subset of the Ruby language is supported, and the detection of type errors is limited. But it is still growing rapidly to improve the coverage of language features, the analysis performance, and usability. Any feedback is very welcome. +TypeProf est expérimental et n'est pas encore mature. Seulement un sous ensemble du langage Ruby est supporté et la détection des erreurs de typage est limitée. Mais il continue de croître rapidement pour améliorer la couverture des fonctionnalités du langage, les performances d'analyse et la convivialité. Tout commentaire est le bienvenu. -## Ractor (experimental) +## Ractor (expérimental) -Ractor est un modèle d'acteur permettant une abstraction pour la concurrence. Il fournit un outil permettant l'execution thread-safe de code. +Ractor est un modèle d'acteur permettant une abstraction pour la concurrence. Il fournit un outil permettant l'exécution de code de façon thread-safe. -Ractor is an Actor-model like concurrent abstraction designed to provide a parallel execution feature without thread-safety concerns. +Vous pouvez créer plusieurs ractors et les lancer en parallèle. Ractor vous permet de créer des programmes thread-safe puisque les ractors ne partagent pas d'objets normaux. La communication entre ractors se fait par passage de messages. -Vous pouvez créer plusieurs ractors et les lancer en parallele. Ractor vous permet de créer des programmes thread-safe car les reactors ne partage pas des objets normaux. La communication entre ractors se fait par passage de message. +Afin de limiter le partage d'objet, Ractor introduit plusieurs restrictions sur la syntaxe de Ruby (sans plusieurs ractors, il n'y a pas de restriction). -You can make multiple ractors and you can run them in parallel. Ractor enables you to make thread-safe parallel programs because ractors can not share normal objects. Communication between ractors are supported by message passing. +La spécification et l'implémentation ne sont pas matures et pourront donc changer. Cette fonctionnalité est marquée comme expérimentale et montre l'avertissement "experimental feature" au premier `Ractor.new`. -Afin de limiter le partage d'objet, Ractor introduit plusieurs restriction sur la syntaxe de Ruby (sans plusieurs ractors, il n'y a pas de restriction). - -To limit sharing of objects, Ractor introduces several restrictions to the Ruby's syntax (without multiple Ractors, there is no restriction). - -La spécification et l'implémintation ne sont pas matures et peuvent changer dans le futur. Par conséquent cette fonctionnalité est marquée commme experimentale et montre l'avertissement "experimental feature" au premier `Ractor.new`. - -The specification and implementation are not matured and may be changed in the future, so this feature is marked as experimental and show the "experimental feature" warning when the first `Ractor.new`. - -Le bout de code suivant calcul `n.prime?` (`n` est un entier relativement grand) en parallele avec deux ractors. Vous pouvez vérifier que le programme est deux fois plus rapide que celui séquentiel sur le calcul parralele. - -The following small program calculates `n.prime?` (`n` is relatively a big integer) in parallel with two ractors. You will confirm that the program execution is about x2 times faster compared to the sequential program on the parallel computer. +Le bout de code suivant calcul `n.prime?` (`n` est un entier relativement grand) en parallèle avec deux ractors. Vous pouvez vérifier que le programme est deux fois plus rapide que celui séquentiel. ```ruby require 'prime' @@ -147,16 +117,11 @@ p r2.take #=> true Voir [doc/ractor.md](https://github.com/ruby/ruby/blob/master/doc/ractor.md) pour plus de details. -See [doc/ractor.md](https://github.com/ruby/ruby/blob/master/doc/ractor.md) for more details. - ## Fiber Scheduler -`Fiber#scheduler` est introduit pour intercepter des opérations de blocage. Cela permet une concurrence légère sans changer le code existant. Voir ["Don't Wait For Me, Scalable Concurrency for Ruby 3"](https://www.youtube.com/watch?v=Y29SSOS4UOc) pour avoir un apercu du fonctionnement. - -`Fiber#scheduler` is introduced for intercepting blocking operations. This allows for light-weight concurrency without changing existing code. Watch ["Don't Wait For Me, Scalable Concurrency for Ruby 3"](https://www.youtube.com/watch?v=Y29SSOS4UOc) for an overview of how it works. +`Fiber#scheduler` est introduit pour intercepter des opérations de blocage. Cela permet une concurrence légère sans changer le code existant. Voir ["Don't Wait For Me, Scalable Concurrency for Ruby 3"](https://www.youtube.com/watch?v=Y29SSOS4UOc) pour avoir un aperçu du fonctionnement. -Currently supported classes/methods: -Les classes et méthodes prises en charge: +Les classes et méthodes prises en charge : - `Mutex#lock`, `Mutex#unlock`, `Mutex#sleep` - `ConditionVariable#wait` @@ -167,10 +132,8 @@ Les classes et méthodes prises en charge: - `IO#wait`, `IO#read`, `IO#write` et les méthodes rattachées (e.g. `#wait_readable`, `#gets`, `#puts` etc.) - `IO#select` n'est _pas prise en charge_. -Cet exemple de code permet de faire plusieurs requetes HTTP de facon concurrente. -(Expliquer la gem Async avec des liens). Cet exemple de code permet de faire plusieurs requetes HTTP de facon concurrente. -(Explain Async gem with links). This example program will perform several HTTP requests concurrently: -(Expler ceci:) +(Expliquer la gem Async avec des liens). Cet exemple de code permet de faire plusieurs requêtes HTTP de façon concurrente. +(Expliquer ceci :) 1. async est une gemme externe 2. async utilise cette nouvelle fonctionnalité @@ -190,10 +153,7 @@ end ## Autres ajouts notables -## Other Notable New Features - - Le filtrage par motif en une ligne utilise `=>` au lieu de `in`. -- One-line pattern matching now uses `=>` instead of `in`. ```ruby # version 3.0 {a: 0, b: 1} => {a:} @@ -216,79 +176,46 @@ end ```ruby def square(x) = x * x ``` -- `Hash#except` est désormais intégré. +- `Hash#except` est désormais inclus. ```ruby h = { a: 1, b: 2, c: 3 } p h.except(:a) #=> {:b=>2, :c=>3} ``` -- Memory view est ajoutée en tant que fonctionnalité experimentale - - - C'est un nouvel ensemble d'API C pour échanger une zone mémoire brute, comme un tableau de nombre ou une image bitmap, entre des bibliotheques d'extension. Les bibliotheques d'extension permettent aussi de partager les méta données de la zone mémoire qui est constituée de la forme, du format de l'élément, etc. En utilisant ce types de métadata, les librairies d'extenstion peuvent partager meme des tableau multidimensionnel de facon approprié. Cette fonctionnalité est concu en se referrant au protocol tampon de python. +- Memory view est ajoutée en tant que fonctionnalité expérimentale - - This is a new C-API set to exchange a raw memory area, such as a numeric array and a bitmap image, between extension libraries. The extension libraries can share also the metadata of the memory area that consists of the shape, the element format, and so on. Using these kinds of metadata, the extension libraries can share even a multidimensional array appropriately. This feature is designed by referring to Python's buffer protocol. + - C'est un nouvel ensemble d'API C pour échanger une zone mémoire brute, comme un tableau de nombre ou une image bitmap, entre des bibliothèques d'extension. Les bibliothèques d'extension peuvent également partager les méta données de la zone mémoire comprenant la forme, le format de l'élément, etc. En utilisant ce type de métadonnées, les librairies d'extension peuvent même partager des tableaux multidimensionnels de façon appropriée. Cette fonctionnalité a été conçue en utilisant le protocole tampon de python. ## Amélioration des performances -## Performance improvements - -- Plusieurs améliorations sont implémentées dans MJIT. Voir NEWS pour les details. -- Coller du code dans IRB est 53 fois plus rapide qu'en Ruby 2.7.0. Par exemple le temps nécessaire pour coller [cet exemple de code](https://gist.github.com/aycabta/30ab96334275bced5796f118c9220b0b) passe de 11.7 secondes à 0.22 secondes. - -- Many improvements were implemented in MJIT. Voir NEWS pour les details. -- Pasting long code to IRB is 53 times faster than bundled with Ruby 2.7.0. For example, the time required to paste [this sample code](https://gist.github.com/aycabta/30ab96334275bced5796f118c9220b0b) goes from 11.7 seconds to 0.22 seconds. +- Plusieurs améliorations sont implémentées dans MJIT. Voir NEWS pour les détails. +- Coller du code dans IRB est 53 fois plus rapide qu'en Ruby 2.7.0. Par exemple, le temps nécessaire pour coller [cet exemple de code](https://gist.github.com/aycabta/30ab96334275bced5796f118c9220b0b) passe de 11.7 secondes à 0.22 secondes. ## Autres changements notables depuis la version 2.7 -## Other notable changes since 2.7 - -- Les arguments de mot clé sont séparé des autres arguments. - - En principe, le code qui affiche un avertissement dans la version 2.7 de ruby ne fonctionnera pas. Voir le [document](https://www.ruby-lang.org/en/news/2019/12/12/separation-of-positional-and-keyword-arguments-in-ruby-3-0/) pour plus de détails. - - La transmission d'arguments prend en charge les arguments de l'en-tête. +- Les arguments de mot-clé sont séparés des autres arguments. + - En principe, le code qui affiche un avertissement dans la version 2.7 de Ruby ne fonctionnera pas. Voir le [document](https://www.ruby-lang.org/en/news/2019/12/12/separation-of-positional-and-keyword-arguments-in-ruby-3-0/) pour plus de détails. + - La transmission d'arguments prend désormais en charge les arguments principaux. ```ruby def method_missing(meth, ...) send(:"do_#{ meth }", ...) end ``` - La fonctionnalité `$SAFE` a été completement supprimée. C'est désormais une variable globale. -- L'ordre de la backtrace a été inversé depuis la version 2.5 de Ruby, mais cela a été remis comme avant. Cela se comporte comme la version 2.4 de Ruby. Le message d'erreur et le numéro de ligne ou l'exception apparait sont affichés en premiers. Les appelants sont affichés apres. +- L'ordre de la backtrace a été inversé depuis la version 2.5 de Ruby, mais cela a été remis comme avant. Cela se comporte comme la version 2.4 de Ruby. Le message d'erreur et le numéro de ligne où l'exception apparait sont affichés en premiers. Les appelants sont affichés apres. - Plusieurs bibliothèques standard ont été mises à jour. - RubyGems 3.2.0.rc.1 - Bundler 2.2.0.rc.1 - IRB 1.2.6 - Reline 0.1.5 -- Les librairies suivantes ne sont plus empaquetées. Il faut installer jes gems correspondantes pour utiliser leurs fonctionnalitées. - - net-telnet - - xmlrpc -- Les gems suivantes sont désormais empaquetées avec Ruby. - - rexml - - rss -- Les fichiers stdlib suivants sont désormais des gems et sont publiées sur rubygems.org. - -- Keyword arguments are separated from other arguments. - - In principle, code that prints a warning on Ruby 2.7 won't work. See the [document](https://www.ruby-lang.org/en/news/2019/12/12/separation-of-positional-and-keyword-arguments-in-ruby-3-0/) in detail. - - By the way, arguments forwarding now supports leading arguments. - ```ruby - def method_missing(meth, ...) - send(:"do_#{ meth }", ...) - end - ``` -- The `$SAFE` feature was completely removed; now it is a normal global variable. -- The order of backtrace had been reversed at Ruby 2.5, and is reverted. Now it behaves like Ruby 2.4; an error message and the line number where the exception occurs are printed first, and its callers are printed later. -- Some standard libraries are updated. - - RubyGems 3.2.0.rc.1 - - Bundler 2.2.0.rc.1 - - IRB 1.2.6 - - Reline 0.1.5 -- The following libraries are no longer bundled gems. - Install the corresponding gems to use these features. +- Les librairies suivantes ne sont plus incluses. Il faut installer les gemmes correspondantes pour utiliser leurs fonctionnalitées. - net-telnet - xmlrpc -- The following default gems are now bundled gems. +- Les gemmes suivantes sont désormais incluses avec Ruby. - rexml - rss -- The following stdlib files are now default gems and are published on rubygems.org. +- Les fichiers stdlib suivants sont désormais des gemmes et sont disponibles sur rubygems.org. - abbrev - base64 - English @@ -323,7 +250,7 @@ ou les [logs de commit](https://github.com/ruby/ruby/compare/v2_7_0...v3_0_0_pre Avec ces changements, [{{ release.stats.files_changed }} fichiers changés, {{ release.stats.insertions }} insertions(+), {{ release.stats.deletions }} suppressions(-)](https://github.com/ruby/ruby/compare/v2_7_0...v3_0_0) depuis Ruby 2.7.0! -Essayez Ruby 3.0.0-preview2 s'il vous plait et faites nous des retours ! +S'il vous plait, essayez Ruby 3.0.0-preview2 et faites nous des retours ! ## Téléchargement @@ -350,8 +277,4 @@ Essayez Ruby 3.0.0-preview2 s'il vous plait et faites nous des retours ! ## Ruby, c'est quoi ? -Ruby a d'abord été developpé par Matz (Yukihiro Matsumoto) en 1993, mais est désormais Open Source. -Ruby fonctionne sur de multiple plateformes et est utilisé à travers le monde notamment dans le développement web. - -and is now developed as Open Source. It runs on multiple platforms -and is used all over the world especially for web development. +Ruby a été initialement développé par Matz (Yukihiro Matsumoto) en 1993 puis est devenu open source. Il fonctionne sur de nombreuses plates-formes et est utilisé partout dans le monde, en particulier pour le développement web. diff --git a/fr/news/_posts/2020-12-20-ruby-3-0-0-rc1-released.md b/fr/news/_posts/2020-12-20-ruby-3-0-0-rc1-released.md index 7bf295f62c..06bc987fa6 100644 --- a/fr/news/_posts/2020-12-20-ruby-3-0-0-rc1-released.md +++ b/fr/news/_posts/2020-12-20-ruby-3-0-0-rc1-released.md @@ -1,47 +1,31 @@ --- layout: news_post -title: "Ruby 3.0.0 RC1 Released" +title: "Ruby 3.0.0 RC1 est disponible" author: "naruse" translator: "chatpitre" date: 2020-12-20 00:00:00 +0000 -lang: en +lang: fr --- Nous sommes heureux de vous annoncer la sortie de Ruby 3.0.0-rc1. -Cela introduit un certain nombre de nouvelles fonctionnalités et d'amélioration de performance. - -We are pleased to announce the release of Ruby 3.0.0-rc1. - -It introduces a number of new features and performance improvements. +Cela introduit un certain nombre de nouvelles fonctionnalités et d'améliorations de performance. ## Analyse statique -## Static Analysis - ### RBS -RBS est un langage qui décrit les types des programmes Ruby. - -Les vérifications de type incluent TypeProf et d'autres outils supportant RBS qui comprennent les programmes Ruby bien mieux avec les définitions RBS. - -Vous pouvez écrire directement la définition des classes et modules : les méthodes définis dans la classe, les variables d'instances et leurs types et les relations d'héritage/mix-in. - -Le but de RBS est de supporter les patterns communs dans les programmes Ruby et de permettre d'écrire des types avancés incluant les unions de types, la surcharge de méthode et les génériques. Cela supporte aussi le duck typing avec _interface types_. +RBS est un langage qui décrit les types de programmes Ruby. -Ruby 3.0 arrive avec la gem `rbs`, qui inclue l'analyse et le traitement des définitions de type écrit en RBS. -Le code ci-dessous est un petit exemple de RBS avec une des définitions de classe, module et constante. +Les vérificateurs de type, y compris TypeProf et d'autres outils prenant en charge RBS, comprendront mieux les programmes Ruby avec des définitions RBS. -RBS is a language to describe the types of Ruby programs. +Vous pouvez écrire la définition des classes et des modules: les méthodes qui sont définies dans la classe, les variables d'instance et leurs types, et les relations d'héritage / mix-in. -Type checkers including TypeProf and other tools supporting RBS will understand Ruby programs much better with RBS definitions. +Le but de RBS est de prendre en charge les modèles couramment observés dans les programmes Ruby et de vous permettre d'écrire des types avancés, notamment les unions de type, les surcharges de méthode et les génériques. Il prend également en charge le duck typing avec _interface types_. -You can write down the definition of classes and modules: methods defined in the class, instance variables and their types, and inheritance/mix-in relations. +Ruby 3.0 arrive avec la gemme `rbs`, qui inclue l'analyse et le traitement des définitions de type écrites en RBS. -The goal of RBS is to support commonly seen patterns in Ruby programs and it allows writing advanced types including union types, method overloading, and generics. It also supports duck typing with _interface types_. - -Ruby 3.0 ships with `rbs` gem, which allows parsing and processing type definitions written in RBS. -The following is a small example of RBS with class, module, and constant definitions. +Le code ci-dessous est un petit exemple de RBS une classe, un module et des définitions de constantes. ```rbs module ChatApp @@ -57,32 +41,20 @@ module ChatApp end ``` -Voir le [README de la gem rbs](https://github.com/ruby/rbs) pour plus de détails - -See [README of rbs gem](https://github.com/ruby/rbs) for more detail. +Voir le [README de la gemme rbs](https://github.com/ruby/rbs) pour plus de détails. ### TypeProf -TypeProf est un outil d'analyse de type compris dans Ruby. +TypeProf est un outil d'analyse de type inclus dans Ruby. Actuellement, TypeProf permet une sorte d'inférence de type. -Cela lit du code Ruby non annoté, analyse quelles méthodes sont définis, comment elles sont utilités et générenet un prototype de signature de type au format RBS. +Il lit du code Ruby sans annotation de type, analyse quelles méthodes sont définies, comment elles sont utilisées et génère un prototype de la signature de type au format RBS. -Voici un exemple simple de TypeProf. +Voici une simple démo de TypeProf. Un exemple d'entrée : -TypeProf is a type analysis tool bundled in the Ruby package. - -Currently, TypeProf serves as a kind of type inference. - -It reads plain (non-type-annotated) Ruby code, analyzes what methods are defined and how they are used, and generates a prototype of type signature in RBS format. - -Here is a simple demo of TypeProf. - -An example input: - ```ruby # test.rb class User @@ -96,8 +68,6 @@ User.new(name: "John", age: 20) Un exemple de sortie : -An example output: - ``` $ typeprof test.rb # Classes @@ -108,43 +78,25 @@ class User end ``` -Vous pouvez lancer TypeProf en sauvegadant l'entrée dans un fichier "test.rb" et en appelant la commande "typeprof test.rb". - -You can run TypeProf by saving the input as "test.rb" and invoke a command called "typeprof test.rb". - -Vous pouvez aussi [essayer TypeProf en ligne](https://mame.github.io/typeprof-playground/#rb=%23+test.rb%0Aclass+User%0A++def+initialize%28name%3A%2C+age%3A%29%0A++++%40name%2C+%40age+%3D+name%2C+age%0A++end%0A++%0A++attr_reader+%3Aname%2C+%3Aage%0Aend%0A%0AUser.new%28name%3A+%22John%22%2C+age%3A+20%29&rbs=). (Cela lance TypeProf coté serveur, donc désolé si c'est) - -You can also [try TypeProf online](https://mame.github.io/typeprof-playground/#rb=%23+test.rb%0Aclass+User%0A++def+initialize%28name%3A%2C+age%3A%29%0A++++%40name%2C+%40age+%3D+name%2C+age%0A++end%0A++%0A++attr_reader+%3Aname%2C+%3Aage%0Aend%0A%0AUser.new%28name%3A+%22John%22%2C+age%3A+20%29&rbs=). (It runs TypeProf on the server side, so sorry if it is out!) - -Voir [la documentation](https://github.com/ruby/typeprof/blob/master/doc/doc.md) et [les demos](https://github.com/ruby/typeprof/blob/master/doc/demo.md) pour plus de détails. - -See [the documentation](https://github.com/ruby/typeprof/blob/master/doc/doc.md) and [demos](https://github.com/ruby/typeprof/blob/master/doc/demo.md) for details. - -TypeProf est expérimental et n'est pas encore mature. Seulement un sous ensemble du langage Ruby est supporté et la détection des erreurs de typage est limitée. Cela évolue rapidement tout de même afin d'améliorer la couvertures des fonctionnalités du langage, l'analyse de performance et la maniabilité. Tout retour est le bienvenue. - -TypeProf is experimental and not so mature yet; only a subset of the Ruby language is supported, and the detection of type errors is limited. But it is still growing rapidly to improve the coverage of language features, the analysis performance, and usability. Any feedback is very welcome. - -## Ractor (experimental) +Vous pouvez lancer TypeProf en sauvegadant le code dans un fichier "test.rb" et en appelant la commande "typeprof test.rb". -Ractor est un modèle d'acteur permettant une abstraction pour la concurrence. Il fournit un outil permettant l'execution thread-safe de code. +Vous pouvez aussi [essayer TypeProf en ligne](https://mame.github.io/typeprof-playground/#rb=%23+test.rb%0Aclass+User%0A++def+initialize%28name%3A%2C+age%3A%29%0A++++%40name%2C+%40age+%3D+name%2C+age%0A++end%0A++%0A++attr_reader+%3Aname%2C+%3Aage%0Aend%0A%0AUser.new%28name%3A+%22John%22%2C+age%3A+20%29&rbs=). (Cela lance TypeProf coté serveur, donc désolé si cela ne fonctionne pas !) -Vous pouvez créer plusieurs ractors et les lancer en parallele. Ractor vous permet de créer des programmes thread-safe car les reactors ne partage pas des objets normaux. La communication entre ractors se fait par passage de message. +Voir [la documentation](https://github.com/ruby/typeprof/blob/master/doc/doc.md) et [les démos](https://github.com/ruby/typeprof/blob/master/doc/demo.md) pour plus de détails. -Afin de limiter le partage d'objet, Ractor introduit plusieurs restriction sur la syntaxe de Ruby (sans plusieurs ractors, il n'y a pas de restriction). +TypeProf est expérimental et n'est pas encore mature. Seulement un sous ensemble du langage Ruby est supporté et la détection des erreurs de typage est limitée. Mais il continue de croître rapidement pour améliorer la couverture des fonctionnalités du langage, les performances d'analyse et la convivialité. Tout commentaire est le bienvenu. -La spécification et l'implémintation ne sont pas matures et peuvent changer dans le futur. Par conséquent cette fonctionnalité est marquée commme experimentale et montre l'avertissement "experimental feature" au premier `Ractor.new`. +## Ractor (expérimental) -Le bout de code suivant calcul `n.prime?` (`n` est un entier relativement grand) en parallele avec deux ractors. Vous pouvez vérifier que le programme est deux fois plus rapide que celui séquentiel sur le calcul parralele. +Ractor est un modèle d'acteur permettant une abstraction pour la concurrence. Il fournit un outil permettant l'exécution de code de façon thread-safe. -Ractor is an Actor-model like concurrent abstraction designed to provide a parallel execution feature without thread-safety concerns. +Vous pouvez créer plusieurs ractors et les lancer en parallèle. Ractor vous permet de créer des programmes thread-safe puisque les ractors ne partagent pas d'objets normaux. La communication entre ractors se fait par passage de messages. -You can make multiple ractors and you can run them in parallel. Ractor enables you to make thread-safe parallel programs because ractors can not share normal objects. Communication between ractors are supported by message passing. +Afin de limiter le partage d'objet, Ractor introduit plusieurs restrictions sur la syntaxe de Ruby (sans plusieurs ractors, il n'y a pas de restriction). -To limit sharing of objects, Ractor introduces several restrictions to the Ruby's syntax (without multiple Ractors, there is no restriction). +La spécification et l'implémentation ne sont pas matures et pourront donc changer. Cette fonctionnalité est marquée comme expérimentale et montre l'avertissement "experimental feature" au premier `Ractor.new`. -The specification and implementation are not matured and may be changed in the future, so this feature is marked as experimental and show the "experimental feature" warning when the first `Ractor.new`. - -The following small program calculates `n.prime?` (`n` is relatively a big integer) in parallel with two ractors. You will confirm that the program execution is about x2 times faster compared to the sequential program on the parallel computer. +Le bout de code suivant calcul `n.prime?` (`n` est un entier relativement grand) en parallèle avec deux ractors. Vous pouvez vérifier que le programme est deux fois plus rapide que celui séquentiel. ```ruby require 'prime' @@ -165,17 +117,11 @@ p r2.take #=> true Voir [doc/ractor.md](https://github.com/ruby/ruby/blob/master/doc/ractor.md) pour plus de details. -See [doc/ractor.md](https://github.com/ruby/ruby/blob/master/doc/ractor.md) for more details. - ## Fiber Scheduler -`Fiber#scheduler` est introduit pour intercepter des opérations de blocage. Cela permet une concurrence légère sans changer le code existant. Voir ["Don't Wait For Me, Scalable Concurrency for Ruby 3"](https://www.youtube.com/watch?v=Y29SSOS4UOc) pour avoir un apercu du fonctionnement. - -`Fiber#scheduler` is introduced for intercepting blocking operations. This allows for light-weight concurrency without changing existing code. Watch ["Don't Wait For Me, Scalable Concurrency for Ruby 3"](https://www.youtube.com/watch?v=Y29SSOS4UOc) for an overview of how it works. +`Fiber#scheduler` est introduit pour intercepter des opérations de blocage. Cela permet une concurrence légère sans changer le code existant. Voir ["Don't Wait For Me, Scalable Concurrency for Ruby 3"](https://www.youtube.com/watch?v=Y29SSOS4UOc) pour avoir un aperçu du fonctionnement. -Les classes et méthodes prises en charge: - -Currently supported classes/methods: +Les classes et méthodes prises en charge : - `Mutex#lock`, `Mutex#unlock`, `Mutex#sleep` - `ConditionVariable#wait` @@ -183,23 +129,15 @@ Currently supported classes/methods: - `Thread#join` - `Kernel#sleep` - `Process.wait` -- `IO#wait`, `IO#read`, `IO#write` and related methods (e.g. `#wait_readable`, `#gets`, `#puts` and so on). -- `IO#select` is _not supported_. +- `IO#wait`, `IO#read`, `IO#write` et les méthodes rattachées (e.g. `#wait_readable`, `#gets`, `#puts` etc.) +- `IO#select` n'est _pas prise en charge_. -Cet exemple de code permet de faire plusieurs requetes HTTP de facon concurrente. -(Expliquer la gem Async avec des liens). Cet exemple de code permet de faire plusieurs requetes HTTP de facon concurrente. -(Expler ceci:) +(Expliquer la gem Async avec des liens). Cet exemple de code permet de faire plusieurs requêtes HTTP de façon concurrente. +(Expliquer ceci :) 1. async est une gemme externe 2. async utilise cette nouvelle fonctionnalité -(Explain Async gem with links). This example program will perform several HTTP requests concurrently: - -(Explain this:) - -1. async is outer gem -2. async uses this new feature - ```ruby require 'async' require 'net/http' @@ -215,13 +153,9 @@ end ## Autres ajouts notables -## Other Notable New Features - -- Le filtrage par motif en une ligne est changé (experimental). -- One-line pattern matching is redesigned. (experimental) +- Le filtrage par motif en une ligne est changé (expérimental). - `=>` est ajouté. Il peut être utilisé comme une affectation à droite. - - `=>` is added. It can be used as like rightward assignment. ```ruby 0 => a @@ -232,7 +166,6 @@ end ``` - `in` est changé pour retourner `true` ou `false`. - - `in` is changed to return `true` or `false`. ```ruby # version 3.0 @@ -242,8 +175,7 @@ end 0 in 1 #=> raise NoMatchingPatternError ``` -- Le pattern Find pattern est ajouté. (experimental) -- Find pattern is added. (experimental) +- Le pattern Find est ajouté. (expérimental) ```ruby case ["a", 1, "b", "c", 2, "d", "e", "f", 3] @@ -255,51 +187,40 @@ end end ``` -- La définition de méthode sans le mot clé `end`. +- La définition de méthode sans le mot clé `end` est ajoutée. ```ruby def square(x) = x * x ``` -- `Hash#except` est désormais intégré. +- `Hash#except` est désormais inclus. ```ruby h = { a: 1, b: 2, c: 3 } p h.except(:a) #=> {:b=>2, :c=>3} ``` -- Memory view est ajoutée en tant que fonctionnalité experimentale - - - C'est un nouvel ensemble d'API C pour échanger une zone mémoire brute, comme un tableau de nombre ou une image bitmap, entre des bibliotheques d'extension. Les bibliotheques d'extension permettent aussi de partager les méta données de la zone mémoire qui est constituée de la forme, du format de l'élément, etc. En utilisant ce types de métadata, les librairies d'extenstion peuvent partager meme des tableau multidimensionnel de facon approprié. Cette fonctionnalité est concu en se referrant au protocol tampon de python. +- Memory view est ajoutée en tant que fonctionnalité expérimentale -- Memory view is added as an experimental feature - - - This is a new C-API set to exchange a raw memory area, such as a numeric array and a bitmap image, between extension libraries. The extension libraries can share also the metadata of the memory area that consists of the shape, the element format, and so on. Using these kinds of metadata, the extension libraries can share even a multidimensional array appropriately. This feature is designed by referring to Python's buffer protocol. + - C'est un nouvel ensemble d'API C pour échanger une zone mémoire brute, comme un tableau de nombre ou une image bitmap, entre des bibliothèques d'extension. Les bibliothèques d'extension peuvent également partager les méta données de la zone mémoire comprenant la forme, le format de l'élément, etc. En utilisant ce type de métadonnées, les librairies d'extension peuvent même partager des tableaux multidimensionnels de façon appropriée. Cette fonctionnalité a été conçue en utilisant le protocole tampon de python. ## Amélioration des performances -## Performance improvements - -- Plusieurs améliorations sont implémentées dans MJIT. Voir NEWS pour les details. -- Coller du code dans IRB est 53 fois plus rapide qu'en Ruby 2.7.0. Par exemple le temps nécessaire pour coller [cet exemple de code](https://gist.github.com/aycabta/30ab96334275bced5796f118c9220b0b) passe de 11.7 secondes à 0.22 secondes. - -- Many improvements were implemented in MJIT. See NEWS in detail. -- Pasting long code to IRB is 53 times faster than bundled with Ruby 2.7.0. For example, the time required to paste [this sample code](https://gist.github.com/aycabta/30ab96334275bced5796f118c9220b0b) goes from 11.7 seconds to 0.22 seconds. +- Plusieurs améliorations sont implémentées dans MJIT. Voir NEWS pour les détails. +- Coller du code dans IRB est 53 fois plus rapide qu'en Ruby 2.7.0. Par exemple, le temps nécessaire pour coller [cet exemple de code](https://gist.github.com/aycabta/30ab96334275bced5796f118c9220b0b) passe de 11.7 secondes à 0.22 secondes. ## Autres changements notables depuis la version 2.7 -## Other notable changes since 2.7 - -- Les arguments de mot clé sont séparé des autres arguments. - - En principe, le code qui affiche un avertissement dans la version 2.7 de ruby ne fonctionnera pas. Voir le [document](https://www.ruby-lang.org/en/news/2019/12/12/separation-of-positional-and-keyword-arguments-in-ruby-3-0/) pour plus de détails. - - La transmission d'arguments prend en charge les arguments de l'en-tête. +- Les arguments de mot-clé sont séparés des autres arguments. + - En principe, le code qui affiche un avertissement dans la version 2.7 de Ruby ne fonctionnera pas. Voir le [document](https://www.ruby-lang.org/en/news/2019/12/12/separation-of-positional-and-keyword-arguments-in-ruby-3-0/) pour plus de détails. + - La transmission d'arguments prend désormais en charge les arguments principaux. ```ruby def method_missing(meth, ...) send(:"do_#{ meth }", ...) end ``` - La fonctionnalité `$SAFE` a été completement supprimée. C'est désormais une variable globale. -- L'ordre de la backtrace a été inversé depuis la version 2.5 de Ruby, mais cela a été remis comme avant. Cela se comporte comme la version 2.4 de Ruby. Le message d'erreur et le numéro de ligne ou l'exception apparait sont affichés en premiers. Les appelants sont affichés apres. +- L'ordre de la backtrace a été inversé depuis la version 2.5 de Ruby, mais cela a été remis comme avant. Cela se comporte comme la version 2.4 de Ruby. Le message d'erreur et le numéro de ligne où l'exception apparait sont affichés en premiers. Les appelants sont affichés apres. - Plusieurs bibliothèques standard ont été mises à jour. - RubyGems 3.2.2 - Bundler 2.2.2 @@ -313,15 +234,15 @@ end - Fiddle 1.0.4 - StringIO 3.0.0 - StringScanner 3.0.0 -- Les librairies suivantes ne sont plus empaquetées. Il faut installer jes gems correspondantes pour utiliser leurs fonctionnalitées. +- Les librairies suivantes ne sont plus incluses. Il faut installer les gemmes correspondantes pour utiliser leurs fonctionnalitées. - net-telnet - xmlrpc -- Les gems suivantes sont désormais empaquetées avec Ruby. +- Les gemmes suivantes sont désormais incluses avec Ruby. - rexml - rss -- Les fichiers stdlib suivants sont désormais des gems et sont publiées sur rubygems.org. -- English +- Les fichiers stdlib suivants sont désormais des gemmes et sont disponibles sur rubygems.org. + - English - abbrev - base64 - drb @@ -367,65 +288,6 @@ end end ``` -- Pattern matching (`case`/`in`) is no longer experimental. -- The `$SAFE` feature was completely removed; now it is a normal global variable. -- The order of backtrace had been reversed at Ruby 2.5, and is reverted. Now it behaves like Ruby 2.4; an error message and the line number where the exception occurs are printed first, and its callers are printed later. -- Some standard libraries are updated. - - RubyGems 3.2.2 - - Bundler 2.2.2 - - IRB 1.2.6 - - Reline 0.1.5 - - Psych 3.2.1 - - JSON 2.4.1 - - BigDecimal 3.0.0 - - CSV 3.1.9 - - Digest 3.0.0 - - Fiddle 1.0.4 - - StringIO 3.0.0 - - StringScanner 3.0.0 -- The following libraries are no longer bundled gems. - Install the corresponding gems to use these features. - - net-telnet - - xmlrpc -- The following default gems are now bundled gems. - - rexml - - rss -- The following stdlib files are now default gems and are published on rubygems.org. - - English - - abbrev - - base64 - - drb - - debug - - erb - - find - - net-ftp - - net-http - - net-imap - - net-protocol - - open-uri - - optparse - - pp - - prettyprint - - resolv-replace - - resolv - - rinda - - set - - securerandom - - shellwords - - tempfile - - tmpdir - - time - - tsort - - un - - weakref - - digest - - io-nonblock - - io-wait - - nkf - - pathname - - syslog - - win32ole - Voir [NEWS](https://github.com/ruby/ruby/blob/v3_0_0_rc1/NEWS.md) ou les [logs de commit](https://github.com/ruby/ruby/compare/v2_7_0...v3_0_0_rc1) pour plus de détails @@ -434,7 +296,7 @@ ou les [logs de commit](https://github.com/ruby/ruby/compare/v2_7_0...v3_0_0_rc1 Avec ces changements, [{{ release.stats.files_changed }} fichiers changés, {{ release.stats.insertions }} insertions(+), {{ release.stats.deletions }} suppressions(-)](https://github.com/ruby/ruby/compare/v2_7_0...v3_0_0) depuis Ruby 2.7.0! -Essayez Ruby 3.0.0-rc1 s'il vous plait et faites nous des retours ! +S'il vous plait, essayez Ruby 3.0.0-rc1 et faites nous des retours ! ## Téléchargement @@ -461,8 +323,4 @@ Essayez Ruby 3.0.0-rc1 s'il vous plait et faites nous des retours ! ## Ruby, c'est quoi ? -Ruby a d'abord été developpé par Matz (Yukihiro Matsumoto) en 1993, mais est désormais Open Source. -Ruby fonctionne sur de multiple plateformes et est utilisé à travers le monde notamment dans le développement web. - -and is now developed as Open Source. It runs on multiple platforms -and is used all over the world especially for web development. +Ruby a été initialement développé par Matz (Yukihiro Matsumoto) en 1993 puis est devenu open source. Il fonctionne sur de nombreuses plates-formes et est utilisé partout dans le monde, en particulier pour le développement web. From aad7b9c3405cdc5829ffc4e9a23fc8ab27f5c20e Mon Sep 17 00:00:00 2001 From: Chatpitre Date: Sat, 27 Mar 2021 09:04:26 +0100 Subject: [PATCH 0012/1090] =?UTF-8?q?d=C3=A9but=20traduction=203.0.0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...2020-12-08-ruby-3-0-0-preview2-released.md | 2 +- .../2020-12-20-ruby-3-0-0-rc1-released.md | 16 +-- .../_posts/2020-12-25-ruby-3-0-0-released.md | 112 +++++++++--------- 3 files changed, 58 insertions(+), 72 deletions(-) diff --git a/fr/news/_posts/2020-12-08-ruby-3-0-0-preview2-released.md b/fr/news/_posts/2020-12-08-ruby-3-0-0-preview2-released.md index c62316b800..aa1dc8467f 100644 --- a/fr/news/_posts/2020-12-08-ruby-3-0-0-preview2-released.md +++ b/fr/news/_posts/2020-12-08-ruby-3-0-0-preview2-released.md @@ -203,7 +203,7 @@ end end ``` - La fonctionnalité `$SAFE` a été completement supprimée. C'est désormais une variable globale. -- L'ordre de la backtrace a été inversé depuis la version 2.5 de Ruby, mais cela a été remis comme avant. Cela se comporte comme la version 2.4 de Ruby. Le message d'erreur et le numéro de ligne où l'exception apparait sont affichés en premiers. Les appelants sont affichés apres. +- L'ordre de la backtrace a été inversé depuis la version 2.5 de Ruby, mais cela a été remis comme avant. Cela se comporte comme la version 2.4 de Ruby. Le message d'erreur et le numéro de ligne où l'exception apparait sont affichés en premiers. Les appelants sont affichés après. - Plusieurs bibliothèques standard ont été mises à jour. - RubyGems 3.2.0.rc.1 - Bundler 2.2.0.rc.1 diff --git a/fr/news/_posts/2020-12-20-ruby-3-0-0-rc1-released.md b/fr/news/_posts/2020-12-20-ruby-3-0-0-rc1-released.md index 06bc987fa6..b4ef7bce5d 100644 --- a/fr/news/_posts/2020-12-20-ruby-3-0-0-rc1-released.md +++ b/fr/news/_posts/2020-12-20-ruby-3-0-0-rc1-released.md @@ -220,7 +220,7 @@ end end ``` - La fonctionnalité `$SAFE` a été completement supprimée. C'est désormais une variable globale. -- L'ordre de la backtrace a été inversé depuis la version 2.5 de Ruby, mais cela a été remis comme avant. Cela se comporte comme la version 2.4 de Ruby. Le message d'erreur et le numéro de ligne où l'exception apparait sont affichés en premiers. Les appelants sont affichés apres. +- L'ordre de la backtrace a été inversé depuis la version 2.5 de Ruby, mais cela a été remis comme avant. Cela se comporte comme la version 2.4 de Ruby. Le message d'erreur et le numéro de ligne où l'exception apparait sont affichés en premiers. Les appelants sont affichés après. - Plusieurs bibliothèques standard ont été mises à jour. - RubyGems 3.2.2 - Bundler 2.2.2 @@ -241,7 +241,6 @@ end - rexml - rss - Les fichiers stdlib suivants sont désormais des gemmes et sont disponibles sur rubygems.org. - - English - abbrev - base64 @@ -277,19 +276,8 @@ end - syslog - win32ole -- Keyword arguments are separated from other arguments. - - - In principle, code that prints a warning on Ruby 2.7 won't work. See the [document](https://www.ruby-lang.org/en/news/2019/12/12/separation-of-positional-and-keyword-arguments-in-ruby-3-0/) in detail. - - By the way, arguments forwarding now supports leading arguments. - - ```ruby - def method_missing(meth, ...) - send(:"do_#{ meth }", ...) - end - ``` - Voir [NEWS](https://github.com/ruby/ruby/blob/v3_0_0_rc1/NEWS.md) -ou les [logs de commit](https://github.com/ruby/ruby/compare/v2_7_0...v3_0_0_rc1) pour plus de détails +ou les [logs de commit](https://github.com/ruby/ruby/compare/v2_7_0...v3_0_0_rc1) pour plus de détails. {% assign release = site.data.releases | where: "version", "3.0.0-rc1" | first %} diff --git a/fr/news/_posts/2020-12-25-ruby-3-0-0-released.md b/fr/news/_posts/2020-12-25-ruby-3-0-0-released.md index bb8bcb433b..b52ec027cb 100644 --- a/fr/news/_posts/2020-12-25-ruby-3-0-0-released.md +++ b/fr/news/_posts/2020-12-25-ruby-3-0-0-released.md @@ -4,7 +4,7 @@ title: "Ruby 3.0.0 est disponible" author: "naruse" translator: "chatpitre" date: 2020-12-25 00:00:00 +0000 -lang: en +lang: fr --- We are pleased to announce the release of Ruby 3.0.0. From 2015 we developed hard toward Ruby 3, whose goal is performance, concurrency, and Typing. Especially about performance, Matz stated "Ruby3 will be 3 times faster than Ruby2" a.k.a. [Ruby 3x3](https://blog.heroku.com/ruby-3-by-3). @@ -88,9 +88,9 @@ See [doc/ractor.md](https://docs.ruby-lang.org/en/3.0.0/doc/ractor_md.html) for ### Fiber Scheduler -`Fiber#scheduler` is introduced for intercepting blocking operations. This allows for light-weight concurrency without changing existing code. Watch ["Don't Wait For Me, Scalable Concurrency for Ruby 3"](https://www.youtube.com/watch?v=Y29SSOS4UOc) for an overview of how it works. +`Fiber#scheduler` est introduit pour intercepter des opérations de blocage. Cela permet une concurrence légère sans changer le code existant. Voir ["Don't Wait For Me, Scalable Concurrency for Ruby 3"](https://www.youtube.com/watch?v=Y29SSOS4UOc) pour avoir un aperçu du fonctionnement. -Currently supported classes/methods: +Les classes et méthodes prises en charge : - `Mutex#lock`, `Mutex#unlock`, `Mutex#sleep` - `ConditionVariable#wait` @@ -98,8 +98,8 @@ Currently supported classes/methods: - `Thread#join` - `Kernel#sleep` - `Process.wait` -- `IO#wait`, `IO#read`, `IO#write`, and related methods (e.g. `#wait_readable`, `#gets`, `#puts`, and so on). -- `IO#select` is _not supported_. +- `IO#wait`, `IO#read`, `IO#write` et les méthodes rattachées (e.g. `#wait_readable`, `#gets`, `#puts` etc.) +- `IO#select` n'est _pas prise en charge_. This example program will perform several HTTP requests concurrently: @@ -125,16 +125,17 @@ It uses [async](https://github.com/socketry/async) which provides the event loop ### RBS -RBS is a language to describe the types of Ruby programs. +RBS est un langage qui décrit les types de programmes Ruby. -Type checkers including TypeProf and other tools supporting RBS will understand Ruby programs much better with RBS definitions. +Les vérificateurs de type, y compris TypeProf et d'autres outils prenant en charge RBS, comprendront mieux les programmes Ruby avec des définitions RBS. -You can write down the definition of classes and modules: methods defined in the class, instance variables and their types, and inheritance/mix-in relations. +Vous pouvez écrire la définition des classes et des modules: les méthodes qui sont définies dans la classe, les variables d'instance et leurs types, et les relations d'héritage / mix-in. -The goal of RBS is to support commonly seen patterns in Ruby programs and it allows writing advanced types including union types, method overloading, and generics. It also supports duck typing with _interface types_. +Le but de RBS est de prendre en charge les modèles couramment observés dans les programmes Ruby et de vous permettre d'écrire des types avancés, notamment les unions de type, les surcharges de méthode et les génériques. Il prend également en charge le duck typing avec _interface types_. -Ruby 3.0 ships with the `rbs` gem, which allows parsing and processing type definitions written in RBS. -The following is a small example of RBS with class, module, and constant definitions. +Ruby 3.0 arrive avec la gemme `rbs`, qui inclue l'analyse et le traitement des définitions de type écrites en RBS. + +Le code ci-dessous est un petit exemple de RBS une classe, un module et des définitions de constantes. ```rbs module ChatApp @@ -150,19 +151,19 @@ module ChatApp end ``` -See [README of rbs gem](https://github.com/ruby/rbs) for more detail. +Voir le [README de la gemme rbs](https://github.com/ruby/rbs) pour plus de détails. ### TypeProf -TypeProf is a type analysis tool bundled in the Ruby package. +TypeProf est un outil d'analyse de type inclus dans Ruby. -Currently, TypeProf serves as a kind of type inference. +Actuellement, TypeProf permet une sorte d'inférence de type. -It reads plain (non-type-annotated) Ruby code, analyzes what methods are defined and how they are used, and generates a prototype of type signature in RBS format. +Il lit du code Ruby sans annotation de type, analyse quelles méthodes sont définies, comment elles sont utilisées et génère un prototype de la signature de type au format RBS. -Here is a simple demo of TypeProf. +Voici une simple démo de TypeProf. -An example input: +Un exemple d'entrée : ```ruby # test.rb @@ -175,7 +176,7 @@ end User.new(name: "John", age: 20) ``` -An example output: +Un exemple de sortie : ``` $ typeprof test.rb @@ -187,19 +188,19 @@ class User end ``` -You can run TypeProf by saving the input as "test.rb" and invoking the command "typeprof test.rb". +Vous pouvez lancer TypeProf en sauvegadant le code dans un fichier "test.rb" et en appelant la commande "typeprof test.rb". -You can also [try TypeProf online](https://mame.github.io/typeprof-playground/#rb=%23+test.rb%0Aclass+User%0A++def+initialize%28name%3A%2C+age%3A%29%0A++++%40name%2C+%40age+%3D+name%2C+age%0A++end%0A++%0A++attr_reader+%3Aname%2C+%3Aage%0Aend%0A%0AUser.new%28name%3A+%22John%22%2C+age%3A+20%29&rbs=). (It runs TypeProf on the server side, so sorry if it is out!) +Vous pouvez aussi [essayer TypeProf en ligne](https://mame.github.io/typeprof-playground/#rb=%23+test.rb%0Aclass+User%0A++def+initialize%28name%3A%2C+age%3A%29%0A++++%40name%2C+%40age+%3D+name%2C+age%0A++end%0A++%0A++attr_reader+%3Aname%2C+%3Aage%0Aend%0A%0AUser.new%28name%3A+%22John%22%2C+age%3A+20%29&rbs=). (Cela lance TypeProf coté serveur, donc désolé si cela ne fonctionne pas !) -See the [TypeProf documentation](https://github.com/ruby/typeprof/blob/master/doc/doc.md) and [demos](https://github.com/ruby/typeprof/blob/master/doc/demo.md) for details. +Voir [la documentation](https://github.com/ruby/typeprof/blob/master/doc/doc.md) et [les démos](https://github.com/ruby/typeprof/blob/master/doc/demo.md) pour plus de détails. -TypeProf is experimental and not so mature yet; only a subset of the Ruby language is supported, and the detection of type errors is limited. But it is still growing rapidly to improve the coverage of language features, the analysis performance, and usability. Any feedback is very welcome. +TypeProf est expérimental et n'est pas encore mature. Seulement un sous ensemble du langage Ruby est supporté et la détection des erreurs de typage est limitée. Mais il continue de croître rapidement pour améliorer la couverture des fonctionnalités du langage, les performances d'analyse et la convivialité. Tout commentaire est le bienvenu. -## Other Notable New Features +## Autres ajouts notables -- One-line pattern matching is redesigned. (experimental) +- Le filtrage par motif en une ligne est changé (expérimental). - - `=>` is added. It can be used like a rightward assignment. + - `=>` est ajouté. Il peut être utilisé comme une affectation à droite. ```ruby 0 => a @@ -209,7 +210,7 @@ TypeProf is experimental and not so mature yet; only a subset of the Ruby langua p b #=> 0 ``` - - `in` is changed to return `true` or `false`. + - `in` est changé pour retourner `true` ou `false`. ```ruby # version 3.0 @@ -219,7 +220,7 @@ TypeProf is experimental and not so mature yet; only a subset of the Ruby langua 0 in 1 #=> raise NoMatchingPatternError ``` -- Find pattern is added. (experimental) +- Le pattern Find est ajouté (expérimental). ```ruby case ["a", 1, "b", "c", 2, "d", "e", "f", 3] @@ -231,32 +232,32 @@ TypeProf is experimental and not so mature yet; only a subset of the Ruby langua end ``` -- Endless method definition is added. +- La définition de méthode sans le mot clé `end` est ajoutée. ```ruby def square(x) = x * x ``` -- `Hash#except` is now built-in. +- `Hash#except` est désormais inclus. ```ruby h = { a: 1, b: 2, c: 3 } p h.except(:a) #=> {:b=>2, :c=>3} ``` -- Memory view is added as an experimental feature +- Memory view est ajoutée en tant que fonctionnalité expérimentale - - This is a new C-API set to exchange a raw memory area, such as a numeric array or a bitmap image, between extension libraries. The extension libraries can share also the metadata of the memory area that consists of the shape, the element format, and so on. Using these kinds of metadata, the extension libraries can share even a multidimensional array appropriately. This feature is designed by referring to Python's buffer protocol. + - C'est un nouvel ensemble d'API C pour échanger une zone mémoire brute, comme un tableau de nombre ou une image bitmap, entre des bibliothèques d'extension. Les bibliothèques d'extension peuvent également partager les méta données de la zone mémoire comprenant la forme, le format de l'élément, etc. En utilisant ce type de métadonnées, les librairies d'extension peuvent même partager des tableaux multidimensionnels de façon appropriée. Cette fonctionnalité a été conçue en utilisant le protocole tampon de python. -## Performance improvements +## Amélioration des performances -- Pasting long code to IRB is 53 times faster than in the version bundled with Ruby 2.7.0. For example, the time required to paste [this sample code](https://gist.github.com/aycabta/30ab96334275bced5796f118c9220b0b) goes from 11.7 seconds to 0.22 seconds. +- Coller du code dans IRB est 53 fois plus rapide qu'en Ruby 2.7.0. Par exemple, le temps nécessaire pour coller [cet exemple de code](https://gist.github.com/aycabta/30ab96334275bced5796f118c9220b0b) passe de 11.7 secondes à 0.22 secondes. -- The `measure` command has been added to IRB. It allows simple execution time measurement. +- La commande `measure` est ajoutée à IRB. Elle permet simplement de mesurer le temps. ``` irb(main):001:0> 3 @@ -273,12 +274,12 @@ TypeProf is experimental and not so mature yet; only a subset of the Ruby langua => 3 ``` -## Other notable changes since 2.7 +## Autres changements notables depuis la version 2.7 -- Keyword arguments are separated from other arguments. +- Les arguments de mot-clé sont séparés des autres arguments. - - In principle, code that prints a warning on Ruby 2.7 won't work. See [this document](https://www.ruby-lang.org/en/news/2019/12/12/separation-of-positional-and-keyword-arguments-in-ruby-3-0/) for details. - - By the way, arguments forwarding now supports leading arguments. + - En principe, le code qui affiche un avertissement dans la version 2.7 de Ruby ne fonctionnera pas. Voir le [document](https://www.ruby-lang.org/en/news/2019/12/12/separation-of-positional-and-keyword-arguments-in-ruby-3-0/) pour plus de détails. + - La transmission d'arguments prend désormais en charge les arguments principaux. ```ruby def method_missing(meth, ...) @@ -286,11 +287,11 @@ TypeProf is experimental and not so mature yet; only a subset of the Ruby langua end ``` -- Pattern matching (`case`/`in`) is no longer experimental. - - See the [pattern matching documentation](https://docs.ruby-lang.org/en/3.0.0/doc/syntax/pattern_matching_rdoc.html) for details. -- The `$SAFE` feature was completely removed; now it is a normal global variable. -- The order of backtraces had been reversed with Ruby 2.5; this change has been reverted. Now backtraces behave like in Ruby 2.4: an error message and the line number where the exception occurs are printed first, and its callers are printed later. -- Some standard libraries are updated. +- Le filtrage par motif (`case`/`in`) n'est plus expérimentale. + - Voir la [documentation du filtrage par motif](https://docs.ruby-lang.org/en/3.0.0/doc/syntax/pattern_matching_rdoc.html) pour plus de détails. +- La fonctionnalité `$SAFE` a été completement supprimée. C'est désormais une variable globale. +- L'ordre de la backtrace a été inversé depuis la version 2.5 de Ruby, mais cela a été remis comme avant. Cela se comporte comme la version 2.4 de Ruby. Le message d'erreur et le numéro de ligne où l'exception apparait sont affichés en premiers. Les appelants sont affichés après. +- Plusieurs bibliothèques standard ont été mises à jour. - RubyGems 3.2.3 - Bundler 2.2.3 - IRB 1.3.0 @@ -305,16 +306,15 @@ TypeProf is experimental and not so mature yet; only a subset of the Ruby langua - StringIO 3.0.0 - StringScanner 3.0.0 - etc. -- The following libraries are no longer bundled gems or standard libraries. - Install the corresponding gems to use these features. +- Les librairies suivantes ne sont plus incluses. Il faut installer les gemmes correspondantes pour utiliser leurs fonctionnalitées. - sdbm - webrick - net-telnet - xmlrpc -- The following default gems are now bundled gems. +- Les gemmes suivantes sont désormais incluses avec Ruby. - rexml - rss -- The following stdlib files are now default gems and are published on rubygems.org. +- Les fichiers stdlib suivants sont désormais des gemmes et sont disponibles sur rubygems.org. - English - abbrev - base64 @@ -350,18 +350,18 @@ TypeProf is experimental and not so mature yet; only a subset of the Ruby langua - syslog - win32ole -See [NEWS](https://github.com/ruby/ruby/blob/{{ release.tag }}/NEWS.md) -or [commit logs](https://github.com/ruby/ruby/compare/v2_7_0...{{ release.tag }}) -for more details. +Voir [NEWS](https://github.com/ruby/ruby/blob/{{ release.tag }}/NEWS.md) +ou les [logs de commit](https://github.com/ruby/ruby/compare/v2_7_0...{{ release.tag }}) +pour plus de détails. -With those changes, [{{ release.stats.files_changed }} files changed, {{ release.stats.insertions }} insertions(+), {{ release.stats.deletions }} deletions(-)](https://github.com/ruby/ruby/compare/v2_7_0...{{ release.tag }}#file_bucket) -since Ruby 2.7.0! +Avec ces changements, [{{ release.stats.files_changed }} fichiers changés, {{ release.stats.insertions }} insertions(+), {{ release.stats.deletions }} suppressions(-)](https://github.com/ruby/ruby/compare/v2_7_0...{{ release.tag }}#file_bucket) +depuis Ruby 2.7.0! > Ruby3.0 is a milestone. The language is evolved, keeping compatibility. But it's not the end. Ruby will keep progressing, and become even greater. Stay tuned! --- Matz Merry Christmas, Happy Holidays, and enjoy programming with Ruby 3.0! -## Download +## Téléchargement - <{{ release.url.gz }}> @@ -384,8 +384,6 @@ Merry Christmas, Happy Holidays, and enjoy programming with Ruby 3.0! SHA256: {{ release.sha256.zip }} SHA512: {{ release.sha512.zip }} -## What is Ruby +## Ruby, c'est quoi ? -Ruby was first developed by Matz (Yukihiro Matsumoto) in 1993 -and is now developed as Open Source. It runs on multiple platforms -and is used all over the world especially for web development. +Ruby a été initialement développé par Matz (Yukihiro Matsumoto) en 1993 puis est devenu open source. Il fonctionne sur de nombreuses plates-formes et est utilisé partout dans le monde, en particulier pour le développement web. From 55d0fb169f9bd20804bb5d1e87f8f06264ca092d Mon Sep 17 00:00:00 2001 From: Chatpitre Date: Sat, 27 Mar 2021 11:12:15 +0100 Subject: [PATCH 0013/1090] fin de la traduction --- fr/index.html | 1 - ...2020-12-08-ruby-3-0-0-preview2-released.md | 2 +- .../2020-12-20-ruby-3-0-0-rc1-released.md | 2 +- .../_posts/2020-12-25-ruby-3-0-0-released.md | 52 +++++++++---------- 4 files changed, 28 insertions(+), 29 deletions(-) diff --git a/fr/index.html b/fr/index.html index 89cbdc00fd..36d8b85d13 100644 --- a/fr/index.html +++ b/fr/index.html @@ -26,4 +26,3 @@

Ruby...

--- -{% include unmaintained.html %} diff --git a/fr/news/_posts/2020-12-08-ruby-3-0-0-preview2-released.md b/fr/news/_posts/2020-12-08-ruby-3-0-0-preview2-released.md index aa1dc8467f..919d1f58cc 100644 --- a/fr/news/_posts/2020-12-08-ruby-3-0-0-preview2-released.md +++ b/fr/news/_posts/2020-12-08-ruby-3-0-0-preview2-released.md @@ -115,7 +115,7 @@ p r1.take #=> true p r2.take #=> true ``` -Voir [doc/ractor.md](https://github.com/ruby/ruby/blob/master/doc/ractor.md) pour plus de details. +Voir [doc/ractor.md](https://github.com/ruby/ruby/blob/master/doc/ractor.md) pour plus de détails. ## Fiber Scheduler diff --git a/fr/news/_posts/2020-12-20-ruby-3-0-0-rc1-released.md b/fr/news/_posts/2020-12-20-ruby-3-0-0-rc1-released.md index b4ef7bce5d..5d57e9f6e6 100644 --- a/fr/news/_posts/2020-12-20-ruby-3-0-0-rc1-released.md +++ b/fr/news/_posts/2020-12-20-ruby-3-0-0-rc1-released.md @@ -115,7 +115,7 @@ p r1.take #=> true p r2.take #=> true ``` -Voir [doc/ractor.md](https://github.com/ruby/ruby/blob/master/doc/ractor.md) pour plus de details. +Voir [doc/ractor.md](https://github.com/ruby/ruby/blob/master/doc/ractor.md) pour plus de détails. ## Fiber Scheduler diff --git a/fr/news/_posts/2020-12-25-ruby-3-0-0-released.md b/fr/news/_posts/2020-12-25-ruby-3-0-0-released.md index b52ec027cb..8fd29fc0d7 100644 --- a/fr/news/_posts/2020-12-25-ruby-3-0-0-released.md +++ b/fr/news/_posts/2020-12-25-ruby-3-0-0-released.md @@ -7,54 +7,54 @@ date: 2020-12-25 00:00:00 +0000 lang: fr --- -We are pleased to announce the release of Ruby 3.0.0. From 2015 we developed hard toward Ruby 3, whose goal is performance, concurrency, and Typing. Especially about performance, Matz stated "Ruby3 will be 3 times faster than Ruby2" a.k.a. [Ruby 3x3](https://blog.heroku.com/ruby-3-by-3). +Nous avons le plaisir de vous annoncer la sortie de Ruby 3.0.0. Nous avons travaillé dur pour atteindre Ruby 3 dont les objectifs sont la performance, la concurrence et le typage. Surtout en ce qui concerne les performances, Matz a déclaré que "Ruby3 sera trois fois plus rapide que Ruby2" a.k.a. [Ruby 3x3](https://blog.heroku.com/ruby-3-by-3). {% assign release = site.data.releases | where: "version", "3.0.0" | first %} Optcarrot 3000 frames -With [Optcarrot benchmark](https://github.com/mame/optcarrot), which measures single thread performance based on NES's game emulation workload, it achieved 3x faster performance than Ruby 2.0!
These were measured at the environment noted in [benchmark-driver.github.io/hardware.html](https://benchmark-driver.github.io/hardware.html). [Commit 8c510e4095](https://github.com/ruby/ruby/commit/8c510e4095) was used as Ruby 3.0. It may not be 3x faster depending on your environment or benchmark.
+Avec [Optcarrot benchmark](https://github.com/mame/optcarrot) qui mesure les performances d'un seul thread basé sur la charge de travail de l'émulation d'un jeu NES, Ruby 3.0 a atteint des performances trois fois plus rapide que Ruby 2.0 !
Les mesures ont été réalisées dans l'environnement suivant : [benchmark-driver.github.io/hardware.html](https://benchmark-driver.github.io/hardware.html). [Commit 8c510e4095](https://github.com/ruby/ruby/commit/8c510e4095) a été utilisé comme Ruby 3.0. Cela peut ne pas être trois fois plus rapide en fonction de votre environnement ou benchmark.
-Ruby 3.0.0 covers those goals by +Ruby 3.0.0 couvre les objectifs de : - Performance - MJIT -- Concurrency +- Concurrence - Ractor - Fiber Scheduler -- Typing (Static Analysis) +- Typage (Analyse statique) - RBS - TypeProf -With the above performance improvement, Ruby 3.0 introduces several new features described below. +Avec le gain de performance, Ruby 3.0 amène de nouvelles fonctionnalités (décrites ci-dessous). ## Performance -> When I first declared "Ruby3x3" in the conference keynote, many including members of the core team felt "Matz is a boaster". In fact, I felt so too. But we did. I am honored to see the core team actually accomplished to make Ruby3.0 three times faster than Ruby2.0 (in some benchmarks). -- Matz +> Quand j'ai déclaré "Ruby3x3" pour la première fois dans le discours d'ouverture de la conférence, de nombreux membres de la core team ont estimé que "Matz est un vantard". En fait, j'en avais aussi l'impression. Mais nous l'avons fait. Je suis honoré de voir ce que la core team a réellement accomplie pour rendre Ruby3.0 trois fois plus rapide que Ruby2.0 (dans certains benchmarks). -- Matz ### MJIT -Many improvements were implemented in MJIT. See NEWS for details. +Plusieurs améliorations ont été implémentées dans MJIT. Voir News pour plus de détails. -As of Ruby 3.0, JIT is supposed to give performance improvements in limited workloads, such as games ([Optcarrot](https://benchmark-driver.github.io/benchmarks/optcarrot/commits.html#chart-1)), AI ([Rubykon](https://benchmark-driver.github.io/benchmarks/rubykon/commits.html)), or whatever application that spends the majority of time in calling a few methods many times. +A partir de Ruby 3.0, JIT est censé améliorer les performances des charges de travail limitées telles que les jeux ([Optcarrot](https://benchmark-driver.github.io/benchmarks/optcarrot/commits.html#chart-1)), l'IA ([Rubykon](https://benchmark-driver.github.io/benchmarks/rubykon/commits.html)), ou n'importe quelle application qui passe la majorité de son temps à appeler quelques méthodes de nombreuse fois. -Although Ruby 3.0 [significantly decreased the size of JIT-ed code](https://twitter.com/k0kubun/status/1256142302608650244), it is still not ready for optimizing workloads like Rails, which often spend time on so many methods and therefore suffer from i-cache misses exacerbated by JIT. Stay tuned for Ruby 3.1 for further improvements on this issue. +Bien que Ruby 3.0 [ait considérablement réduit la taille du code JIT](https://twitter.com/k0kubun/status/1256142302608650244), il n'est toujours pas prêt pour optimiser des charges de travail comme Rails, qui passe souvent du temps sur tant de méthodes qu'il souffre de problèmes d'i-cache exacerbés par JIT. Restez à l'écoute de Ruby 3.1 pour d'autres améliorations sur ce problème. -## Concurrency / Parallel +## Concurrence / Parallèle -> It's multi-core age today. Concurrency is very important. With Ractor, along with Async Fiber, Ruby will be a real concurrent language. --- Matz +> Aujourd'hui est l'ère du multi-cœur. La concurrence est très importante. Avec Ractor et Async Fiber, Ruby sera un véritable langage concurrent. --- Matz -### Ractor (experimental) +### Ractor (expérimental) -Ractor is an Actor-model like concurrent abstraction designed to provide a parallel execution feature without thread-safety concerns. +Ractor est un modèle d'acteur permettant une abstraction pour la concurrence. Il fournit un outil permettant l'exécution de code de façon thread-safe. -You can make multiple ractors and you can run them in parallel. Ractor enables you to make thread-safe parallel programs because ractors can not share normal objects. Communication between ractors is supported by exchanging messages. +Vous pouvez créer plusieurs ractors et les lancer en parallèle. Ractor vous permet de créer des programmes thread-safe puisque les ractors ne partagent pas d'objets normaux. La communication entre ractors se fait par passage de messages. -To limit the sharing of objects, Ractor introduces several restrictions to Ruby's syntax (without multiple Ractors, there is no restriction). +Afin de limiter le partage d'objet, Ractor introduit plusieurs restrictions sur la syntaxe de Ruby (sans plusieurs ractors, il n'y a pas de restriction). -The specification and implementation are not matured and may be changed in the future, so this feature is marked as experimental and shows the "experimental feature" warning when the first `Ractor.new` occurs. +La spécification et l'implémentation ne sont pas matures et pourront donc changer. Cette fonctionnalité est marquée comme expérimentale et montre l'avertissement "experimental feature" au premier `Ractor.new`. -The following small program measures the execution time of the famous benchmark tak function ([Tak (function) - Wikipedia]()), by executing it 4 times sequentially or 4 times in parallel with ractors. +Le bout de code suivant mesure le temps d'exécution du célèbre benchmark de ([la fonction de Takeuchi - Wikipedia](https://fr.wikipedia.org/wiki/Fonction_de_Takeuchi)) en l'exécutant quatre fois de façon séquentielle ou quatre fois en parallèle avec des ractors. ```ruby def tarai(x, y, z) = @@ -82,9 +82,9 @@ seq 64.560736 0.001101 64.561837 ( 64.562194) par 66.422010 0.015999 66.438009 ( 16.685797) ``` -The result was measured on Ubuntu 20.04, Intel(R) Core(TM) i7-6700 (4 cores, 8 hardware threads). It shows that the parallel version is 3.87 times faster than the sequential version. +Les résultats sont mesurés sur Ubuntu 20.04, Intel(R) Core(TM) i7-6700 (4 cores, 8 hardware threads). Cela montre que la version exécutée en parallèle est 3.87 fois plus rapide que la version séquentielle. -See [doc/ractor.md](https://docs.ruby-lang.org/en/3.0.0/doc/ractor_md.html) for more details. +Voir [doc/ractor.md](https://docs.ruby-lang.org/en/3.0.0/doc/ractor_md.html) pour plus de détails. ### Fiber Scheduler @@ -101,7 +101,7 @@ Les classes et méthodes prises en charge : - `IO#wait`, `IO#read`, `IO#write` et les méthodes rattachées (e.g. `#wait_readable`, `#gets`, `#puts` etc.) - `IO#select` n'est _pas prise en charge_. -This example program will perform several HTTP requests concurrently: +Cet exemple de code permet de faire plusieurs requêtes HTTP de façon concurrente. ```ruby require 'async' @@ -117,11 +117,11 @@ Async do end ``` -It uses [async](https://github.com/socketry/async) which provides the event loop. This event loop uses the `Fiber#scheduler` hooks to make `Net::HTTP` non-blocking. Other gems can use this interface to provide non-blocking execution for Ruby, and those gems can be compatible with other implementations of Ruby (e.g. JRuby, TruffleRuby) which can support the same non-blocking hooks. +Cela utilise [async](https://github.com/socketry/async) qui fournit la boucle d'évènements. Cette boucle utilise les hooks `Fiber#scheduler` pour rendre `Net::HTTP` non bloquant. D'autres gemmes peuvent utiliser cette interface afin de fournir une exécution non bloquante à Ruby et peuvent être compatibles avec d'autres implémentations de Ruby (par exemple, JRuby, TruffleRuby) qui peuvent prendre en charge les mêmes hooks non bloquants. -## Static Analysis +## Analyse statique -> 2010s were an age of statically typed programming languages. Ruby seeks the future with static type checking, without type declaration, using abstract interpretation. RBS & TypeProf are the first step to the future. More steps to come. --- Matz +> Les années 2010 ont été une ère de langages de programmation statiquement typés. Ruby souhaite un futur avec de la vérification de type statique, sans déclaration de type, en utilisant une interprétation abstraite. RBS et TypeProf sont la première étape vers le futur. D'autres étapes sont à venir. --- Matz ### RBS @@ -357,9 +357,9 @@ pour plus de détails. Avec ces changements, [{{ release.stats.files_changed }} fichiers changés, {{ release.stats.insertions }} insertions(+), {{ release.stats.deletions }} suppressions(-)](https://github.com/ruby/ruby/compare/v2_7_0...{{ release.tag }}#file_bucket) depuis Ruby 2.7.0! -> Ruby3.0 is a milestone. The language is evolved, keeping compatibility. But it's not the end. Ruby will keep progressing, and become even greater. Stay tuned! --- Matz +> Ruby3.0 est une étape importante. Le langage évolue en restant compatible. Mais ce n'est pas la fin. Ruby continuera à progresser et deviendra encore plus grand. Restez à l'écoute ! --- Matz -Merry Christmas, Happy Holidays, and enjoy programming with Ruby 3.0! +Joyeux Noël, bonnes vacances, et profitez de la programmation avec Ruby 3.0! ## Téléchargement From 53a786f7f748a3d69d283dc119c2865e415e4ac7 Mon Sep 17 00:00:00 2001 From: Manaleak Date: Tue, 6 Apr 2021 01:29:39 +0200 Subject: [PATCH 0014/1090] Translate latest news posts (fr) --- fr/index.html | 1 - .../_posts/2021-04-05-ruby-2-5-9-released.md | 58 ++++++++++++++++++ .../_posts/2021-04-05-ruby-2-6-7-released.md | 61 +++++++++++++++++++ .../_posts/2021-04-05-ruby-2-7-3-released.md | 54 ++++++++++++++++ .../_posts/2021-04-05-ruby-3-0-1-released.md | 47 ++++++++++++++ ...ath-traversal-on-windows-cve-2021-28966.md | 32 ++++++++++ ...p-vulnerability-in-rexml-cve-2021-28965.md | 44 +++++++++++++ 7 files changed, 296 insertions(+), 1 deletion(-) create mode 100644 fr/news/_posts/2021-04-05-ruby-2-5-9-released.md create mode 100644 fr/news/_posts/2021-04-05-ruby-2-6-7-released.md create mode 100644 fr/news/_posts/2021-04-05-ruby-2-7-3-released.md create mode 100644 fr/news/_posts/2021-04-05-ruby-3-0-1-released.md create mode 100644 fr/news/_posts/2021-04-05-tempfile-path-traversal-on-windows-cve-2021-28966.md create mode 100644 fr/news/_posts/2021-04-05-xml-round-trip-vulnerability-in-rexml-cve-2021-28965.md diff --git a/fr/index.html b/fr/index.html index 89cbdc00fd..36d8b85d13 100644 --- a/fr/index.html +++ b/fr/index.html @@ -26,4 +26,3 @@

Ruby...

--- -{% include unmaintained.html %} diff --git a/fr/news/_posts/2021-04-05-ruby-2-5-9-released.md b/fr/news/_posts/2021-04-05-ruby-2-5-9-released.md new file mode 100644 index 0000000000..945c6db0ec --- /dev/null +++ b/fr/news/_posts/2021-04-05-ruby-2-5-9-released.md @@ -0,0 +1,58 @@ +--- +layout: news_post +title: "Ruby 2.5.9 est disponible" +author: "usa" +translator: "Manaleak2d" +date: 2021-04-05 12:00:00 +0000 +lang: fr +--- + +Ruby 2.5.9 est disponible. + +Cette version contient des corrections concernant des problèmes de sécurité. +Merci de regarder les sujets suivants pour plus de détails. + +- [CVE-2020-25613: Potential HTTP Request Smuggling Vulnerability in WEBrick]({%link en/news/_posts/2020-09-29-http-request-smuggling-cve-2020-25613.md %}) +- [CVE-2021-28965: XML round-trip vulnerability in REXML]({% link en/news/_posts/2021-04-05-xml-round-trip-vulnerability-in-rexml-cve-2021-28965.md %}) + +Voir les [logs de commit](https://github.com/ruby/ruby/compare/v2_5_8...v2_5_9) pour de plus amples informations. + +Après cette version, la branche 2.5 n'est plus officiellement supportée. Cela signifie donc que c'est la dernière version de la branche 2.5. +Nous ne publierons pas de version 2.5.10 même si une faille de sécurité est découverte. +Nous recommandons à tous les utilisateurs de Ruby 2.5 de passer à la version de Ruby 3.0, 2.7 ou 2.6 immédiatement. + +## Téléchargement + +{% assign release = site.data.releases | where: "version", "2.5.9" | first %} + +- <{{ release.url.bz2 }}> + + SIZE: {{ release.size.bz2 }} + SHA1: {{ release.sha1.bz2 }} + SHA256: {{ release.sha256.bz2 }} + SHA512: {{ release.sha512.bz2 }} + +- <{{ release.url.gz }}> + + SIZE: {{ release.size.gz }} + SHA1: {{ release.sha1.gz }} + SHA256: {{ release.sha256.gz }} + SHA512: {{ release.sha512.gz }} + +- <{{ release.url.xz }}> + + SIZE: {{ release.size.xz }} + SHA1: {{ release.sha1.xz }} + SHA256: {{ release.sha256.xz }} + SHA512: {{ release.sha512.xz }} + +- <{{ release.url.zip }}> + + SIZE: {{ release.size.zip }} + SHA1: {{ release.sha1.zip }} + SHA256: {{ release.sha256.zip }} + SHA512: {{ release.sha512.zip }} + +## Commentaire de version + +Merci à celles et ceux qui ont aidé pour cette version, notamment les personnes ayant reporté les vulnérabilités. diff --git a/fr/news/_posts/2021-04-05-ruby-2-6-7-released.md b/fr/news/_posts/2021-04-05-ruby-2-6-7-released.md new file mode 100644 index 0000000000..6c5d6f6659 --- /dev/null +++ b/fr/news/_posts/2021-04-05-ruby-2-6-7-released.md @@ -0,0 +1,61 @@ +--- +layout: news_post +title: "Ruby 2.6.7 est disponible" +author: "usa" +translator: "Manaleak2d" +date: 2021-04-05 12:00:00 +0000 +lang: fr +--- + +Ruby 2.6.7 est disponible. + +Cette version contient des corrections concernant des problèmes de sécurité. +Merci de regarder les sujets suivants pour plus de détails. + +- [CVE-2020-25613: Potential HTTP Request Smuggling Vulnerability in WEBrick]({%link en/news/_posts/2020-09-29-http-request-smuggling-cve-2020-25613.md %}) +- [CVE-2021-28965: XML round-trip vulnerability in REXML]({% link en/news/_posts/2021-04-05-xml-round-trip-vulnerability-in-rexml-cve-2021-28965.md %}) + +Voir les [logs de commit](https://github.com/ruby/ruby/compare/v2_6_6...v2_6_7) pour de plus amples informations. + +A partir de cette version, nous terminons la phase de maintenance standard de la branche 2.6 et entrons dans la phase de maintenance de sécurité. +Cela signifie qu'il n'y aura plus de _backports_ de correctifs pour Ruby 2.6 sauf pour ceux concernant la sécurité. +Cette phase de maintenance réduite se terminera dans un an. La branche 2.6 de Ruby ne sera alors plus officiellement supportée. +Nous vous recommandons donc passer vers Ruby 2.7 ou 3.0. + +## Téléchargement + +{% assign release = site.data.releases | where: "version", "2.6.7" | first %} + +- <{{ release.url.bz2 }}> + + SIZE: {{ release.size.bz2 }} + SHA1: {{ release.sha1.bz2 }} + SHA256: {{ release.sha256.bz2 }} + SHA512: {{ release.sha512.bz2 }} + +- <{{ release.url.gz }}> + + SIZE: {{ release.size.gz }} + SHA1: {{ release.sha1.gz }} + SHA256: {{ release.sha256.gz }} + SHA512: {{ release.sha512.gz }} + +- <{{ release.url.xz }}> + + SIZE: {{ release.size.xz }} + SHA1: {{ release.sha1.xz }} + SHA256: {{ release.sha256.xz }} + SHA512: {{ release.sha512.xz }} + +- <{{ release.url.zip }}> + + SIZE: {{ release.size.zip }} + SHA1: {{ release.sha1.zip }} + SHA256: {{ release.sha256.zip }} + SHA512: {{ release.sha512.zip }} + +## Commentaire de version + +Merci aux contributeurs, développeurs et utilisateurs qui, en reportant les bugs, nous ont permis de faire cette version. + +La maintenance de Ruby 2.6, incluant cette version, est basée sur l' "Agreement for the Ruby stable version" de la Ruby Association. diff --git a/fr/news/_posts/2021-04-05-ruby-2-7-3-released.md b/fr/news/_posts/2021-04-05-ruby-2-7-3-released.md new file mode 100644 index 0000000000..7ff88a2073 --- /dev/null +++ b/fr/news/_posts/2021-04-05-ruby-2-7-3-released.md @@ -0,0 +1,54 @@ +--- +layout: news_post +title: "Ruby 2.7.3 est disponible" +author: "nagachika" +translator: "Manaleak2d" +date: 2021-04-05 12:00:00 +0000 +lang: fr +--- + +Ruby 2.7.3 est disponible. + +Cette version contient des corrections concernant des problèmes de sécurité. +Merci de regarder les sujets suivants pour plus de détails. + +- [CVE-2021-28965: XML round-trip vulnerability in REXML]({% link en/news/_posts/2021-04-05-xml-round-trip-vulnerability-in-rexml-cve-2021-28965.md %}) +- [CVE-2021-28966: Path traversal in Tempfile on Windows]({% link en/news/_posts/2021-04-05-tempfile-path-traversal-on-windows-cve-2021-28966.md %}) + +Voir les [logs de commit](https://github.com/ruby/ruby/compare/v2_7_2...v2_7_3) pour de plus amples informations. + +## Téléchargement + +{% assign release = site.data.releases | where: "version", "2.7.3" | first %} + +- <{{ release.url.bz2 }}> + + SIZE: {{ release.size.bz2 }} + SHA1: {{ release.sha1.bz2 }} + SHA256: {{ release.sha256.bz2 }} + SHA512: {{ release.sha512.bz2 }} + +- <{{ release.url.gz }}> + + SIZE: {{ release.size.gz }} + SHA1: {{ release.sha1.gz }} + SHA256: {{ release.sha256.gz }} + SHA512: {{ release.sha512.gz }} + +- <{{ release.url.xz }}> + + SIZE: {{ release.size.xz }} + SHA1: {{ release.sha1.xz }} + SHA256: {{ release.sha256.xz }} + SHA512: {{ release.sha512.xz }} + +- <{{ release.url.zip }}> + + SIZE: {{ release.size.zip }} + SHA1: {{ release.sha1.zip }} + SHA256: {{ release.sha256.zip }} + SHA512: {{ release.sha512.zip }} + +## Commentaire de version + +Merci aux contributeurs, développeurs et utilisateurs qui, en reportant les bugs, nous ont permis de faire cette version. diff --git a/fr/news/_posts/2021-04-05-ruby-3-0-1-released.md b/fr/news/_posts/2021-04-05-ruby-3-0-1-released.md new file mode 100644 index 0000000000..f0121a2917 --- /dev/null +++ b/fr/news/_posts/2021-04-05-ruby-3-0-1-released.md @@ -0,0 +1,47 @@ +--- +layout: news_post +title: "Ruby 3.0.1 est disponible" +author: "naruse" +translator: "Manaleak2d" +date: 2021-04-05 12:00:00 +0000 +lang: fr +--- + +Ruby 3.0.1 est disponible. + +Cette version contient des corrections concernant des problèmes de sécurité. +Merci de regarder les sujets suivants pour plus de détails. + +- [CVE-2021-28965: XML round-trip vulnerability in REXML]({% link en/news/_posts/2021-04-05-xml-round-trip-vulnerability-in-rexml-cve-2021-28965.md %}) +- [CVE-2021-28966: Path traversal in Tempfile on Windows]({% link en/news/_posts/2021-04-05-tempfile-path-traversal-on-windows-cve-2021-28966.md %}) + +Voir les [logs de commit](https://github.com/ruby/ruby/compare/v3_0_0...v3_0_1) pour de plus amples informations. + +## Téléchargement + +{% assign release = site.data.releases | where: "version", "3.0.1" | first %} + +- <{{ release.url.gz }}> + + SIZE: {{ release.size.gz }} + SHA1: {{ release.sha1.gz }} + SHA256: {{ release.sha256.gz }} + SHA512: {{ release.sha512.gz }} + +- <{{ release.url.xz }}> + + SIZE: {{ release.size.xz }} + SHA1: {{ release.sha1.xz }} + SHA256: {{ release.sha256.xz }} + SHA512: {{ release.sha512.xz }} + +- <{{ release.url.zip }}> + + SIZE: {{ release.size.zip }} + SHA1: {{ release.sha1.zip }} + SHA256: {{ release.sha256.zip }} + SHA512: {{ release.sha512.zip }} + +## Commentaire de version + +Merci aux contributeurs, développeurs et utilisateurs qui, en reportant les bugs, nous ont permis de faire cette version. diff --git a/fr/news/_posts/2021-04-05-tempfile-path-traversal-on-windows-cve-2021-28966.md b/fr/news/_posts/2021-04-05-tempfile-path-traversal-on-windows-cve-2021-28966.md new file mode 100644 index 0000000000..e65cecd177 --- /dev/null +++ b/fr/news/_posts/2021-04-05-tempfile-path-traversal-on-windows-cve-2021-28966.md @@ -0,0 +1,32 @@ +--- +layout: news_post +title: "CVE-2021-28966: Path traversal dans Tempfile sur Windows" +author: "mame" +translator: "Manaleak2d" +date: 2021-04-05 12:00:00 +0000 +tags: security +lang: fr +--- + +Il y a une vulnérabilité involontaire dans la création de répertoire dans la bibliothèque tmpdir inclue dans Ruby sur Windows. Il y a aussi une vulnérabilité involontaire dans la création de fichier dans la bibliothèque tempfile inclue dans Ruby sur Windows, car elle utilise tmpdir en interne. Cette vulnérabilité possède l'identifiant CVE [CVE-2021-28966](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-28966). + +## Détails + +La méthode `Dir.mktmpdir` introduite dans la bibliothèque tmpdir accepte le préfixe et le suffixe du répertoire créé comme premier paramètre. Le préfixe peut contenir des spécificateurs de répertoires relatifs `"..\\"`, donc cette méthode peut être utilisée pour atteindre n'importe quel répertoire. Par conséquent, si un script accepte une entrée externe comme préfixe et que le répertoire cible n'a pas les permissions appropriées ou que le processus ruby possède des privilèges inappropriés, l'attaquant peut créer un répertoire ou un fichier dans n'importe quel répertoire. + +C'est le même problème que [CVE-2018-6914](https://www.ruby-lang.org/en/news/2018/03/28/unintentional-file-and-directory-creation-with-directory-traversal-cve-2018-6914/), mais le correctif précédent était incomplet sur Windows. + +Tous les utilisateurs qui possède une version concernée devraient faire la mise à jour immédiatement. + +## Versions concernées + +- Ruby 2.7.2 ou inférieure +- Ruby 3.0.0 + +## Crédits + +Merci à [Bugdiscloseguys](https://hackerone.com/bugdiscloseguys) pour la découverte de ce problème. + +## Historique + +- Paru initialement le 2021-04-05 12:00:00 (UTC) diff --git a/fr/news/_posts/2021-04-05-xml-round-trip-vulnerability-in-rexml-cve-2021-28965.md b/fr/news/_posts/2021-04-05-xml-round-trip-vulnerability-in-rexml-cve-2021-28965.md new file mode 100644 index 0000000000..2f29eeeffb --- /dev/null +++ b/fr/news/_posts/2021-04-05-xml-round-trip-vulnerability-in-rexml-cve-2021-28965.md @@ -0,0 +1,44 @@ +--- +layout: news_post +title: "CVE-2021-28965: Vulnérabilité XML round-trip dans REXML" +author: "mame" +translator: "Manaleak2d" +date: 2021-04-05 12:00:00 +0000 +tags: security +lang: fr +--- + +Il y a une vulnérabilité _XML round-trip_ dans la gemme REXML inclue dans Ruby. Cette vulnérabilité possède l'identifiant CVE [CVE-2021-28965](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-28965). Nous vous recommandons fortement de faire la mise à jour de la gemme REXML. + +## Détails + +Lors de l'analyse et de la sérialisation d'un document XML spécialement conçu, la gemme REXML (y compris celle fournie avec Ruby) peut créer un mauvais document XML dont la structure est différente de l'original. L'impact de ce problème dépend fortement du contexte, mais il peut conduire à une vulnérabilité dans certains programmes qui utilisent REXML. + +Veuillez mettre à jour la gemme REXML vers la version 3.2.5 ou supérieure. + +Si vous utilisez Ruby 2.6 ou supérieure : + +- Veuillez utiliser Ruby 2.6.7, 2.7.3, ou 3.0.1. +- Vous pouvez également utiliser `gem update rexml` pour la mettre à jour. Si vous utilisez bundler, veuillez ajouter `gem "rexml", ">= 3.2.5"` à votre `Gemfile` + +Si vous utilisez Ruby 2.5.8 ou inférieure : + +- Veuillez utiliser Ruby 2.5.9. +- Vous ne pouvez pas utiliser `gem update rexml` pour Ruby 2.5.8 ou inférieure. +- Notez que la branche 2.5 de Ruby n'est plus officiellement supportée. Veuillez mettre à jour Ruby vers la version 2.6.7 ou supérieure dès que possible. + +## Versions concernées + +- Ruby 2.5.8 ou inférieure (vous NE POUVEZ PAS utiliser `gem upgrade rexml` pour ces versions.) +- Ruby 2.6.7 ou inférieure +- Ruby 2.7.2 ou inférieure +- Ruby 3.0.1 ou inférieure +- REXML gem 3.2.4 ou inférieure + +## Crédits + +Merci à [Juho Nurminen](https://hackerone.com/jupenur) pour la découverte de ce problème. + +## Historique + +- Paru initialement le 2021-04-05 12:00:00 (UTC) From 93a9947ad8e5d0f8f827172c21a2605446c22107 Mon Sep 17 00:00:00 2001 From: manaleak Date: Mon, 3 May 2021 21:10:27 +0200 Subject: [PATCH 0015/1090] Translate latest news posts (fr) --- ...2021-05-02-os-command-injection-in-rdoc.md | 42 +++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 fr/news/_posts/2021-05-02-os-command-injection-in-rdoc.md diff --git a/fr/news/_posts/2021-05-02-os-command-injection-in-rdoc.md b/fr/news/_posts/2021-05-02-os-command-injection-in-rdoc.md new file mode 100644 index 0000000000..05aa226cce --- /dev/null +++ b/fr/news/_posts/2021-05-02-os-command-injection-in-rdoc.md @@ -0,0 +1,42 @@ +--- +layout: news_post +title: "CVE-2021-31799: Faille d'injection de commandes dans RDoc" +author: "aycabta" +translator: "Manaleak2d" +date: 2021-05-02 09:00:00 +0000 +tags: security +lang: en +--- + +Il y a une faille concernant l'injection de commandes dans RDoc qui est inclue dans Ruby. +Il est recommandé aux utilisateurs de Ruby de mettre à jour RDoc vers la dernière version afin de corriger la faille. + +## Détails + +La faille suivante a été signalée. + +- [CVE-2021-31799](https://nvd.nist.gov/vuln/detail/CVE-2021-31799) + +RDoc fait appel à `Kernel#open` pour ouvrir un fichier localement. Si un projet Ruby possède un fichier dont le nom commence par `|` et se termine par `tags`, alors la commande suivant le pipe (barre verticale) est exécutée. Un projet Ruby malveillant pourrait exploiter ce comportement pour exécuter des commandes arbitraires à l'encontre de l'utilisateur qui tente de lancer `rdoc` + +Les utilisateurs du Ruby dont la version de RDoc est concernée par cette faille devrait faire une mise à jour vers la dernière version de RDoc. + +## Versions concernées + +- Toutes les versions de RDoc depuis la 3.11 jusqu'à la 6.3.0 + +## Comment mettre à jour ? + +Veuillez lancer la commande suivante pour mettre à jour RDoc à la dernière version (6.3.1 ou supérieure) afin de corriger la faille. + +``` +gem install rdoc +``` + +## Remerciements + +Merci à [Alexandr Savca](https://hackerone.com/chinarulezzz) d'avoir signalé cette faille. + +## Historique + +- Paru initialement le 2021-05-02 09:00:00 UTC From 7447694307e53b6dcdde078c45b4075e2aa48651 Mon Sep 17 00:00:00 2001 From: manaleak <81834849+manaleak2d@users.noreply.github.com> Date: Fri, 7 May 2021 13:39:33 +0200 Subject: [PATCH 0016/1090] Update 2021-05-02-os-command-injection-in-rdoc.md --- fr/news/_posts/2021-05-02-os-command-injection-in-rdoc.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fr/news/_posts/2021-05-02-os-command-injection-in-rdoc.md b/fr/news/_posts/2021-05-02-os-command-injection-in-rdoc.md index 05aa226cce..68fde7fa64 100644 --- a/fr/news/_posts/2021-05-02-os-command-injection-in-rdoc.md +++ b/fr/news/_posts/2021-05-02-os-command-injection-in-rdoc.md @@ -5,7 +5,7 @@ author: "aycabta" translator: "Manaleak2d" date: 2021-05-02 09:00:00 +0000 tags: security -lang: en +lang: fr --- Il y a une faille concernant l'injection de commandes dans RDoc qui est inclue dans Ruby. From c3103b7aa8da7bf327d9501e9e0f5375d1176d1b Mon Sep 17 00:00:00 2001 From: Alexande B Date: Sun, 10 Oct 2021 10:55:38 +0200 Subject: [PATCH 0017/1090] Add information about chocolatey --- en/documentation/installation/index.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/en/documentation/installation/index.md b/en/documentation/installation/index.md index 9d32ab5d1d..1cc5090529 100644 --- a/en/documentation/installation/index.md +++ b/en/documentation/installation/index.md @@ -47,6 +47,7 @@ Here are available installation methods: * [OpenBSD](#openbsd) * [OpenIndiana](#openindiana) * [Windows Package Manager](#winget) + * [Chocolatey package manager for Windows](#chocolatey) * [Other Distributions](#other-systems) * [Installers](#installers) * [ruby-build](#ruby-build) @@ -228,6 +229,18 @@ to install Ruby: > winget install Ruby {% endhighlight %} +### Chocolatey package manager for Windows +{: #chocolatey} + +Also on Windows, you can use the [Chocolatey Package Manager](https://chocolatey.org/install) +to install Ruby: + +{% highlight sh %} +> choco install ruby +{% endhighlight %} + +It will reuse existing `msys2`, or install own for complete Ruby development environment + ### Other Distributions {: #other-systems} From 5750a052f340031a6197be6fbdc52698983d95e1 Mon Sep 17 00:00:00 2001 From: Chayoung You Date: Mon, 11 Oct 2021 15:50:46 +0900 Subject: [PATCH 0018/1090] Translate "Ruby 3.0.0 Preview 2 Released" (ko) (#2698) --- ...2020-12-08-ruby-3-0-0-preview2-released.md | 277 ++++++++++++++++++ 1 file changed, 277 insertions(+) create mode 100644 ko/news/_posts/2020-12-08-ruby-3-0-0-preview2-released.md diff --git a/ko/news/_posts/2020-12-08-ruby-3-0-0-preview2-released.md b/ko/news/_posts/2020-12-08-ruby-3-0-0-preview2-released.md new file mode 100644 index 0000000000..d7802da402 --- /dev/null +++ b/ko/news/_posts/2020-12-08-ruby-3-0-0-preview2-released.md @@ -0,0 +1,277 @@ +--- +layout: news_post +title: "Ruby 3.0.0 Preview 2 릴리스" +author: "naruse" +translator: "yous" +date: 2020-12-08 00:00:00 +0000 +lang: ko +--- + +Ruby 3.0.0-preview2 릴리스를 알리게 되어 기쁩니다. + +이번 버전은 많은 새 기능과 성능 향상을 포함하고 있습니다. + +## 정적 분석 + +### RBS + +RBS는 Ruby 프로그램의 타입을 기술하기 위한 언어입니다. + +TypeProf와 다른 도구들을 포함해서, RBS를 지원하는 타입 검사기는 RBS 정의를 통해 루비 프로그램을 더 잘 이해합니다. + +클래스나 모듈에 정의된 메서드, 인스턴스 변수와 타입, 상속이나 믹스인 관계에 대한 정의를 작성할 수 있습니다. + +RBS의 목표는 루비 프로그램에서 흔히 보이는 패턴을 지원하는 것과 유니언 타입, 메서드 오버로딩, 제네릭을 포함하는 고급 타입을 지원하는 것입니다. 또한 _인터페이스 타입_을 이용해 덕타이핑을 지원합니다. + +Ruby 3.0은 RBS로 작성된 타입 정의를 해석하고 처리하는 `rbs` gem을 포함합니다. +다음은 클래스, 모듈, 상수 정의를 포함하는 RBS의 작은 예시입니다. + +``` rbs +module ChatApp + VERSION: String + class Channel + attr_reader name: String + attr_reader messages: Array[Message] + attr_reader users: Array[User | Bot] # `|`는 유니언 타입을 의미합니다. 여기에서는 `User` 또는 `Bot`이라는 의미입니다. + def initialize: (String) -> void + def post: (String, from: User | Bot) -> Message # 메서드 오버로딩을 지원합니다. + | (File, from: User | Bot) -> Message + end +end +``` + +더 자세한 내용은 [rbs gem의 README](https://github.com/ruby/rbs)를 확인하세요. + +### TypeProf + +TypeProf는 Ruby 패키지에 포함된 타입 분석 도구입니다. + +지금의 TypeProf는 타입 추론 도구 역할을 합니다. + +TypeProf는 타입 어노테이션이 없는 일반적인 Ruby 코드를 읽어서, 어떤 메서드가 정의되어 있고 어떻게 사용되는지 분석하고, RBS 형식으로 타입 시그니처의 프로토타입을 생성합니다. + +다음은 TypeProf의 간단한 데모입니다. + +예제 입력입니다. + +``` ruby +# test.rb +class User + def initialize(name:, age:) + @name, @age = name, age + end + attr_reader :name, :age +end +User.new(name: "John", age: 20) +``` + +예제 출력입니다. + +``` +$ typeprof test.rb +# Classes +class User + attr_reader name : String + attr_reader age : Integer + def initialize : (name: String, age: Integer) -> [String, Integer] +end +``` + +입력을 "test.rb"에 저장하고 "typeprof test.rb" 커맨드를 통해 TypeProf를 실행할 수 있습니다. + +[TypeProf를 온라인에서 사용](https://mame.github.io/typeprof-playground/#rb=%23+test.rb%0Aclass+User%0A++def+initialize%28name%3A%2C+age%3A%29%0A++++%40name%2C+%40age+%3D+name%2C+age%0A++end%0A++%0A++attr_reader+%3Aname%2C+%3Aage%0Aend%0A%0AUser.new%28name%3A+%22John%22%2C+age%3A+20%29&rbs=)해볼 수도 있습니다. (TypeProf를 서버 쪽에서 실행하는 거라서, 잠시 동작하지 않을 수도 있습니다!) + +더 자세한 내용은 [문서](https://github.com/ruby/typeprof/blob/master/doc/doc.md)와 [데모](https://github.com/ruby/typeprof/blob/master/doc/demo.md)를 확인하세요. + +TypeProf는 실험적이고 아직 완성되지 않았습니다. Ruby 언어의 일부만 지원되고, 타입 오류 감지 기능은 제한적입니다. 하지만 언어 기능의 지원 범위, 분석 성능, 사용성이 빠르게 개선되고 있는 중입니다. 어떤 종류의 피드백이든 환영합니다. + +## Ractor (실험적) +Ractor는 스레드 안전에 대한 걱정이 없는 병렬 실행을 제공하기 위해 설계된 액터 모델과 비슷한 동시 실행 추상화 모델입니다. + +여러 개의 Ractor를 만들고 병렬로 실행할 수 있습니다. Ractor는 일반 객체를 공유할 수 없기 때문에 스레드 안전한 병렬 프로그램을 만들 수 있습니다. Ractor 간의 통신은 메시지 넘기기를 통해서 지원됩니다. + +객체 공유를 제한하기 위해, Ractor는 Ruby 문법에 여러 제한을 추가했습니다(여러 개의 Ractor를 사용하지 않는다면 제한은 없습니다). + +명세와 구현은 아직 완성되지 않았으므로 앞으로 변경될 수 있습니다. 그러므로 이 기능은 실험적으로 제공되며 처음 `Ractor.new`를 실행하면 "실험적 기능"이라는 경고를 표시합니다. + +다음은 2개의 Ractor를 통해 `n.prime?`(`n`은 상대적으로 큰 정수)을 계산하는 작은 프로그램입니다. 병렬 컴퓨터에서 순차적으로 실행하는 프로그램보다 약 2배 빠르다는 걸 확인할 수 있습니다. + +``` ruby +require 'prime' +# r1, r2에 보낸 정수들로 n.prime?을 병렬 실행 +r1, r2 = *(1..2).map do + Ractor.new do + n = Ractor.recv + n.prime? + end +end +# 파라미터를 송신 +r1.send 2**61 - 1 +r2.send 2**61 + 15 +# expr1, expr2의 실행 결과 대기 +p r1.take #=> true +p r2.take #=> true +``` + +더 자세한 내용은 [doc/ractor.md](https://github.com/ruby/ruby/blob/master/doc/ractor.md)를 확인하세요. + +## Fiber 스케줄러 + +블로킹 작업에 끼어들 수 있는 `Fiber#scheduler`가 도입됩니다. 이는 기존에 존재하는 코드를 변경하지 않고 가벼운 동시성을 지원할 수 있게 합니다. 어떻게 동작하는지 궁금하다면 ["Don't Wait For Me, Scalable Concurrency for Ruby 3"](https://www.youtube.com/watch?v=Y29SSOS4UOc)을 보세요. + +현재 지원되는 클래스와 메서드는 다음과 같습니다. + +- `Mutex#lock`, `Mutex#unlock`, `Mutex#sleep` +- `ConditionVariable#wait` +- `Queue#pop`, `SizedQueue#push` +- `Thread#join` +- `Kernel#sleep` +- `Process.wait` +- `IO#wait`, `IO#read`, `IO#write`와 관련 메서드(예: `#wait_readable`, `#gets`, `#puts` 등). +- `IO#select`는 *지원되지 않습니다*. +(Async gem에 대해 링크와 함께 설명하기). 이 예제는 몇 가지 HTTP 요청을 동시에 수행합니다. +(다음을 설명하기:) +1. async는 외부 gem이다. +2. async는 다음 새 기능을 사용한다. + +``` ruby +require 'async' +require 'net/http' +require 'uri' +Async do + ["ruby", "python", "c"].each do |topic| + Async do + Net::HTTP.get(URI "https://www.google.com/search?q=#{topic}") + end + end +end +``` + +## 그 이외의 주목할 만한 기능 + +* 한 줄 패턴 매칭이 `in` 대신 `=>`를 사용합니다. + ``` ruby + # 버전 3.0 + {a: 0, b: 1} => {a:} + p a # => 0 + # 버전 2.7 + {a: 0, b: 1} in {a:} + p a # => 0 + ``` +* 검색 패턴이 추가됩니다. + ``` ruby + case ["a", 1, "b", "c", 2, "d", "e", "f", 3] + in [*pre, String => x, String => y, *post] + p pre #=> ["a", 1] + p x #=> "b" + p y #=> "c" + p post #=> [2, "d", "e", "f", 3] + end + ``` +* end 없는 메서드 정의가 추가됩니다. + ``` ruby + def square(x) = x * x + ``` +* `Hash#except`가 내장됩니다. + ``` ruby + h = { a: 1, b: 2, c: 3 } + p h.except(:a) #=> {:b=>2, :c=>3} + ``` +* 메모리 뷰가 실험적인 기능으로 추가됩니다. + * 이는 숫자 배열이나 비트맵 이미지와 같은 메모리 공간을 확장 라이브러리 간에 교환하기 위한 새로운 C-API 집합입니다. 확장 라이브러리는 모양, 요소의 형식 등으로 구성된 메모리 공간의 메타데이터를 공유할 수 있습니다. 이러한 메타데이터를 사용하여 확장 라이브러리는 다차원 배열을 적절하게 공유할 수 있습니다. 이 기능은 Python의 버퍼 프로토콜을 참고하여 설계되었습니다. + +## 성능 향상 + +* MJIT에 많은 개선이 추가되었습니다. 자세한 내용은 NEWS를 확인하세요. +* IRB에 긴 코드를 붙여 넣는 속도가 Ruby 2.7.0에 포함된 버전보다 53배 빨라졌습니다. 예를 들어, [이 샘플 코드](https://gist.github.com/aycabta/30ab96334275bced5796f118c9220b0b)를 붙여 넣는 데 드는 시간이 11.7초에서 0.22초로 줄어들었습니다. + +## 그 이외의 2.7 이후로 주목할 만한 변경 + +* 키워드 인자가 다른 인자들로부터 분리됩니다. + * 원칙적으로 Ruby 2.7에서 경고를 출력하는 코드는 동작하지 않습니다. 자세한 내용은 [문서](https://www.ruby-lang.org/en/news/2019/12/12/separation-of-positional-and-keyword-arguments-in-ruby-3-0/)를 확인하세요. + * 한편, 인자를 전달할 때 앞쪽 인자를 사용할 수 있습니다. + ``` ruby + def method_missing(meth, ...) + send(:"do_#{ meth }", ...) + end + ``` +* `$SAFE` 기능이 완전히 제거됩니다. 이 값은 이제 일반 전역 변수입니다. +* Ruby 2.5에서 백트레이스의 순서가 역순이 되었습니다만, 이를 취소합니다. 이제 백트레이스는 Ruby 2.4처럼 동작합니다. 예외가 발생한 곳의 오류 메시지와 줄 번호가 가장 먼저 출력되며, 이를 호출한 곳의 정보가 그 뒤에 출력됩니다. +* 표준 라이브러리를 업데이트했습니다. + * RubyGems 3.2.0.rc.1 + * Bundler 2.2.0.rc.1 + * IRB 1.2.6 + * Reline 0.1.5 +* 다음 라이브러리는 이제 기본으로 포함되지 않습니다. + 각 기능이 필요한 경우에는 해당하는 gem을 설치해주세요. + * net-telnet + * xmlrpc +* 다음 기본 gem은 이제 내장 gem이 됩니다. + * rexml + * rss +* 다음 표준 라이브러리가 기본 gem이 되고, rubygems.org에 배포됩니다. + * abbrev + * base64 + * English + * erb + * find + * io-nonblock + * io-wait + * net-ftp + * net-http + * net-imap + * net-protocol + * nkf + * open-uri + * optparse + * resolv + * resolv-replace + * rinda + * securerandom + * set + * shellwords + * tempfile + * time + * tmpdir + * tsort + * weakref + +더 자세한 내용은 [NEWS](https://github.com/ruby/ruby/blob/v3_0_0_preview2/NEWS.md)나 +[커밋 로그](https://github.com/ruby/ruby/compare/v2_7_0...v3_0_0_preview2)를 +확인해주세요. + +{% assign release = site.data.releases | where: "version", "3.0.0-preview2" | first %} + +이러한 변경사항에 따라, Ruby 2.7.0 이후로 [파일 {{ release.stats.files_changed }}개 수정, {{ release.stats.insertions }}줄 추가(+), {{ release.stats.deletions }}줄 삭제(-)](https://github.com/ruby/ruby/compare/v2_7_0...v3_0_0)가 +이루어졌습니다! + +Ruby 3.0.0-preview2를 사용해보시고, 피드백을 보내주세요! + +## 다운로드 + +* <{{ release.url.gz }}> + + SIZE: {{ release.size.gz }} + SHA1: {{ release.sha1.gz }} + SHA256: {{ release.sha256.gz }} + SHA512: {{ release.sha512.gz }} + +* <{{ release.url.xz }}> + + SIZE: {{ release.size.xz }} + SHA1: {{ release.sha1.xz }} + SHA256: {{ release.sha256.xz }} + SHA512: {{ release.sha512.xz }} + +* <{{ release.url.zip }}> + + SIZE: {{ release.size.zip }} + SHA1: {{ release.sha1.zip }} + SHA256: {{ release.sha256.zip }} + SHA512: {{ release.sha512.zip }} + +## Ruby는 + +Ruby는 1993년에 Matz(마츠모토 유키히로) 씨가 처음 개발했고, +현재는 오픈 소스로서 개발되고 있습니다. 여러 플랫폼에서 동작하며, +특히 웹 개발에서 전 세계적으로 이용되고 있습니다. From a1cfad2c9c047a0abba83f081432eecce1acff95 Mon Sep 17 00:00:00 2001 From: Alejandra Cernas Date: Thu, 14 Oct 2021 08:56:17 -0500 Subject: [PATCH 0019/1090] Update Home text on es.yml Add translation for the home button --- _data/locales/es.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_data/locales/es.yml b/_data/locales/es.yml index 679539743e..e193c328f9 100644 --- a/_data/locales/es.yml +++ b/_data/locales/es.yml @@ -3,7 +3,7 @@ ruby: Ruby slogan: El mejor amigo de un desarrollador sitelinks: -- text: Home +- text: Inicio url: /es home: true - text: Descargas From c1a3f7a05fd23bb108679bf84eef05d701ac2be3 Mon Sep 17 00:00:00 2001 From: Chayoung You Date: Tue, 19 Oct 2021 03:43:30 +0900 Subject: [PATCH 0020/1090] Translate "Ruby 3.0.0 RC1 Released" (ko) (#2700) * Translate "Ruby 3.0.0 RC1 Released" (ko) * Fix typo --- ...2020-12-08-ruby-3-0-0-preview2-released.md | 4 +- .../2020-12-20-ruby-3-0-0-rc1-released.md | 320 ++++++++++++++++++ 2 files changed, 322 insertions(+), 2 deletions(-) create mode 100644 ko/news/_posts/2020-12-20-ruby-3-0-0-rc1-released.md diff --git a/ko/news/_posts/2020-12-08-ruby-3-0-0-preview2-released.md b/ko/news/_posts/2020-12-08-ruby-3-0-0-preview2-released.md index d7802da402..a795aef51a 100644 --- a/ko/news/_posts/2020-12-08-ruby-3-0-0-preview2-released.md +++ b/ko/news/_posts/2020-12-08-ruby-3-0-0-preview2-released.md @@ -17,11 +17,11 @@ Ruby 3.0.0-preview2 릴리스를 알리게 되어 기쁩니다. RBS는 Ruby 프로그램의 타입을 기술하기 위한 언어입니다. -TypeProf와 다른 도구들을 포함해서, RBS를 지원하는 타입 검사기는 RBS 정의를 통해 루비 프로그램을 더 잘 이해합니다. +TypeProf와 다른 도구들을 포함해서, RBS를 지원하는 타입 검사기는 RBS 정의를 통해 Ruby 프로그램을 더 잘 이해합니다. 클래스나 모듈에 정의된 메서드, 인스턴스 변수와 타입, 상속이나 믹스인 관계에 대한 정의를 작성할 수 있습니다. -RBS의 목표는 루비 프로그램에서 흔히 보이는 패턴을 지원하는 것과 유니언 타입, 메서드 오버로딩, 제네릭을 포함하는 고급 타입을 지원하는 것입니다. 또한 _인터페이스 타입_을 이용해 덕타이핑을 지원합니다. +RBS의 목표는 Ruby 프로그램에서 흔히 보이는 패턴을 지원하는 것과 유니언 타입, 메서드 오버로딩, 제네릭을 포함하는 고급 타입을 지원하는 것입니다. 또한 _인터페이스 타입_을 이용해 덕타이핑을 지원합니다. Ruby 3.0은 RBS로 작성된 타입 정의를 해석하고 처리하는 `rbs` gem을 포함합니다. 다음은 클래스, 모듈, 상수 정의를 포함하는 RBS의 작은 예시입니다. diff --git a/ko/news/_posts/2020-12-20-ruby-3-0-0-rc1-released.md b/ko/news/_posts/2020-12-20-ruby-3-0-0-rc1-released.md new file mode 100644 index 0000000000..e1cc1a3944 --- /dev/null +++ b/ko/news/_posts/2020-12-20-ruby-3-0-0-rc1-released.md @@ -0,0 +1,320 @@ +--- +layout: news_post +title: "Ruby 3.0.0 RC1 릴리스" +author: "naruse" +translator: "yous" +date: 2020-12-20 00:00:00 +0000 +lang: ko +--- + +Ruby 3.0.0-rc1 릴리스를 알리게 되어 기쁩니다. + +이번 버전은 많은 새 기능과 성능 향상을 포함하고 있습니다. + +## 정적 분석 + +### RBS + +RBS는 Ruby 프로그램의 타입을 기술하기 위한 언어입니다. + +TypeProf와 다른 도구들을 포함해서, RBS를 지원하는 타입 검사기는 RBS 정의를 통해 Ruby 프로그램을 더 잘 이해합니다. + +클래스나 모듈에 정의된 메서드, 인스턴스 변수와 타입, 상속이나 믹스인 관계에 대한 정의를 작성할 수 있습니다. + +RBS의 목표는 Ruby 프로그램에서 흔히 보이는 패턴을 지원하는 것과 유니언 타입, 메서드 오버로딩, 제네릭을 포함하는 고급 타입을 지원하는 것입니다. 또한 _인터페이스 타입_을 이용해 덕타이핑을 지원합니다. + +Ruby 3.0은 RBS로 작성된 타입 정의를 해석하고 처리하는 `rbs` gem을 포함합니다. +다음은 클래스, 모듈, 상수 정의를 포함하는 RBS의 작은 예시입니다. + +``` rbs +module ChatApp + VERSION: String + class Channel + attr_reader name: String + attr_reader messages: Array[Message] + attr_reader users: Array[User | Bot] # `|`는 유니언 타입을 의미합니다. 여기에서는 `User` 또는 `Bot`이라는 의미입니다. + def initialize: (String) -> void + def post: (String, from: User | Bot) -> Message # 메서드 오버로딩을 지원합니다. + | (File, from: User | Bot) -> Message + end +end +``` + +더 자세한 내용은 [rbs gem의 README](https://github.com/ruby/rbs)를 확인하세요. + +### TypeProf + +TypeProf는 Ruby 패키지에 포함된 타입 분석 도구입니다. + +지금의 TypeProf는 타입 추론 도구 역할을 합니다. + +TypeProf는 타입 어노테이션이 없는 일반적인 Ruby 코드를 읽어서, 어떤 메서드가 정의되어 있고 어떻게 사용되는지 분석하고, RBS 형식으로 타입 시그니처의 프로토타입을 생성합니다. + +다음은 TypeProf의 간단한 데모입니다. + +예제 입력입니다. + +``` ruby +# test.rb +class User + def initialize(name:, age:) + @name, @age = name, age + end + attr_reader :name, :age +end +User.new(name: "John", age: 20) +``` + +예제 출력입니다. + +``` +$ typeprof test.rb +# Classes +class User + attr_reader name : String + attr_reader age : Integer + def initialize : (name: String, age: Integer) -> [String, Integer] +end +``` + +입력을 "test.rb"에 저장하고 "typeprof test.rb" 커맨드를 통해 TypeProf를 실행할 수 있습니다. + +[TypeProf를 온라인에서 사용](https://mame.github.io/typeprof-playground/#rb=%23+test.rb%0Aclass+User%0A++def+initialize%28name%3A%2C+age%3A%29%0A++++%40name%2C+%40age+%3D+name%2C+age%0A++end%0A++%0A++attr_reader+%3Aname%2C+%3Aage%0Aend%0A%0AUser.new%28name%3A+%22John%22%2C+age%3A+20%29&rbs=)해볼 수도 있습니다. (TypeProf를 서버 쪽에서 실행하는 거라서, 잠시 동작하지 않을 수도 있습니다!) + +더 자세한 내용은 [문서](https://github.com/ruby/typeprof/blob/master/doc/doc.md)와 [데모](https://github.com/ruby/typeprof/blob/master/doc/demo.md)를 확인하세요. + +TypeProf는 실험적이고 아직 완성되지 않았습니다. Ruby 언어의 일부만 지원되고, 타입 오류 감지 기능은 제한적입니다. 하지만 언어 기능의 지원 범위, 분석 성능, 사용성이 빠르게 개선되고 있는 중입니다. 어떤 종류의 피드백이든 환영합니다. + +## Ractor (실험적) + +Ractor는 스레드 안전에 대한 걱정이 없는 병렬 실행을 제공하기 위해 설계된 액터 모델과 비슷한 동시 실행 추상화 모델입니다. + +여러 개의 Ractor를 만들고 병렬로 실행할 수 있습니다. Ractor는 일반 객체를 공유할 수 없기 때문에 스레드 안전한 병렬 프로그램을 만들 수 있습니다. Ractor 간의 통신은 메시지 넘기기를 통해서 지원됩니다. + +객체 공유를 제한하기 위해, Ractor는 Ruby 문법에 여러 제한을 추가했습니다(여러 개의 Ractor를 사용하지 않는다면 제한은 없습니다). + +명세와 구현은 아직 완성되지 않았으므로 앞으로 변경될 수 있습니다. 그러므로 이 기능은 실험적으로 제공되며 처음 `Ractor.new`를 실행하면 "실험적 기능"이라는 경고를 표시합니다. + +다음은 2개의 Ractor를 통해 `n.prime?`(`n`은 상대적으로 큰 정수)을 계산하는 작은 프로그램입니다. 병렬 컴퓨터에서 순차적으로 실행하는 프로그램보다 약 2배 빠르다는 걸 확인할 수 있습니다. + +``` ruby +require 'prime' +# r1, r2에 보낸 정수들로 n.prime?을 병렬 실행 +r1, r2 = *(1..2).map do + Ractor.new do + n = Ractor.receive + n.prime? + end +end +# 파라미터를 송신 +r1.send 2**61 - 1 +r2.send 2**61 + 15 +# expr1, expr2의 실행 결과 대기 +p r1.take #=> true +p r2.take #=> true +``` + +더 자세한 내용은 [doc/ractor.md](https://github.com/ruby/ruby/blob/master/doc/ractor.md)를 확인하세요. + +## Fiber 스케줄러 + +블로킹 작업에 끼어들 수 있는 `Fiber#scheduler`가 도입됩니다. 이는 기존에 존재하는 코드를 변경하지 않고 가벼운 동시성을 지원할 수 있게 합니다. 어떻게 동작하는지 궁금하다면 ["Don't Wait For Me, Scalable Concurrency for Ruby 3"](https://www.youtube.com/watch?v=Y29SSOS4UOc)을 보세요. + +현재 지원되는 클래스와 메서드는 다음과 같습니다. + +- `Mutex#lock`, `Mutex#unlock`, `Mutex#sleep` +- `ConditionVariable#wait` +- `Queue#pop`, `SizedQueue#push` +- `Thread#join` +- `Kernel#sleep` +- `Process.wait` +- `IO#wait`, `IO#read`, `IO#write`와 관련 메서드(예: `#wait_readable`, `#gets`, `#puts` 등). +- `IO#select`는 *지원되지 않습니다*. + +(Async gem에 대해 링크와 함께 설명하기). 이 예제는 몇 가지 HTTP 요청을 동시에 수행합니다. + +(다음을 설명하기:) +1. async는 외부 gem이다. +2. async는 다음 새 기능을 사용한다. + +``` ruby +require 'async' +require 'net/http' +require 'uri' +Async do + ["ruby", "python", "c"].each do |topic| + Async do + Net::HTTP.get(URI "https://www.google.com/search?q=#{topic}") + end + end +end +``` + +## 그 이외의 주목할 만한 기능 + +* 한 줄 패턴 매칭을 재설계했습니다. (실험적) + + * `=>`가 추가됩니다. 오른 방향 대입처럼 사용할 수 있습니다. + + ```ruby + 0 => a + p a #=> 0 + + {b: 0, c: 1} => {b:} + p b #=> 0 + ``` + + * `in`이 `true` 또는 `false`를 반환하도록 변경됩니다. + + ```ruby + # 버전 3.0 + 0 in 1 #=> false + + # 버전 2.7 + 0 in 1 #=> raise NoMatchingPatternError + ``` + +* 검색 패턴이 추가됩니다. (실험적) + + ``` ruby + case ["a", 1, "b", "c", 2, "d", "e", "f", 3] + in [*pre, String => x, String => y, *post] + p pre #=> ["a", 1] + p x #=> "b" + p y #=> "c" + p post #=> [2, "d", "e", "f", 3] + end + ``` + +* end 없는 메서드 정의가 추가됩니다. + + ``` ruby + def square(x) = x * x + ``` + +* `Hash#except`가 내장됩니다. + + ``` ruby + h = { a: 1, b: 2, c: 3 } + p h.except(:a) #=> {:b=>2, :c=>3} + ``` + +* 메모리 뷰가 실험적인 기능으로 추가됩니다. + + * 이는 숫자 배열이나 비트맵 이미지와 같은 메모리 공간을 확장 라이브러리 간에 교환하기 위한 새로운 C-API 집합입니다. 확장 라이브러리는 모양, 요소의 형식 등으로 구성된 메모리 공간의 메타데이터를 공유할 수 있습니다. 이러한 메타데이터를 사용하여 확장 라이브러리는 다차원 배열을 적절하게 공유할 수 있습니다. 이 기능은 Python의 버퍼 프로토콜을 참고하여 설계되었습니다. + +## 성능 향상 + +* MJIT에 많은 개선이 추가되었습니다. 자세한 내용은 NEWS를 확인하세요. +* IRB에 긴 코드를 붙여 넣는 속도가 Ruby 2.7.0에 포함된 버전보다 53배 빨라졌습니다. 예를 들어, [이 샘플 코드](https://gist.github.com/aycabta/30ab96334275bced5796f118c9220b0b)를 붙여 넣는 데 드는 시간이 11.7초에서 0.22초로 줄어들었습니다. + +## 그 이외의 2.7 이후로 주목할 만한 변경 + +* 키워드 인자가 다른 인자들로부터 분리됩니다. + * 원칙적으로 Ruby 2.7에서 경고를 출력하는 코드는 동작하지 않습니다. 자세한 내용은 [문서](https://www.ruby-lang.org/en/news/2019/12/12/separation-of-positional-and-keyword-arguments-in-ruby-3-0/)를 확인하세요. + * 한편, 인자를 전달할 때 앞쪽 인자를 사용할 수 있습니다. + + ``` ruby + def method_missing(meth, ...) + send(:"do_#{ meth }", ...) + end + ``` + +* 패턴 매칭(`case`/`in`)은 이제 실험적이지 않습니다. +* `$SAFE` 기능이 완전히 제거됩니다. 이 값은 이제 일반 전역 변수입니다. +* Ruby 2.5에서 백트레이스의 순서가 역순이 되었습니다만, 이를 취소합니다. 이제 백트레이스는 Ruby 2.4처럼 동작합니다. 예외가 발생한 곳의 오류 메시지와 줄 번호가 가장 먼저 출력되며, 이를 호출한 곳의 정보가 그 뒤에 출력됩니다. +* 표준 라이브러리를 업데이트했습니다. + * RubyGems 3.2.2 + * Bundler 2.2.2 + * IRB 1.2.6 + * Reline 0.1.5 + * Psych 3.2.1 + * JSON 2.4.1 + * BigDecimal 3.0.0 + * CSV 3.1.9 + * Digest 3.0.0 + * Fiddle 1.0.4 + * StringIO 3.0.0 + * StringScanner 3.0.0 +* 다음 라이브러리는 이제 기본으로 포함되지 않습니다. + 각 기능이 필요한 경우에는 해당하는 gem을 설치해주세요. + * net-telnet + * xmlrpc +* 다음 기본 gem은 이제 내장 gem이 됩니다. + * rexml + * rss +* 다음 표준 라이브러리가 기본 gem이 되고, rubygems.org에 배포됩니다. + * English + * abbrev + * base64 + * drb + * debug + * erb + * find + * net-ftp + * net-http + * net-imap + * net-protocol + * open-uri + * optparse + * pp + * prettyprint + * resolv-replace + * resolv + * rinda + * set + * securerandom + * shellwords + * tempfile + * tmpdir + * time + * tsort + * un + * weakref + * digest + * io-nonblock + * io-wait + * nkf + * pathname + * syslog + * win32ole + +더 자세한 내용은 [NEWS](https://github.com/ruby/ruby/blob/v3_0_0_rc1/NEWS.md)나 +[커밋 로그](https://github.com/ruby/ruby/compare/v2_7_0...v3_0_0_rc1)를 +확인해주세요. + +{% assign release = site.data.releases | where: "version", "3.0.0-rc1" | first %} + +이러한 변경사항에 따라, Ruby 2.7.0 이후로 [파일 {{ release.stats.files_changed }}개 수정, {{ release.stats.insertions }}줄 추가(+), {{ release.stats.deletions }}줄 삭제(-)](https://github.com/ruby/ruby/compare/v2_7_0...v3_0_0)가 +이루어졌습니다! + +Ruby 3.0.0-rc1을 사용해보시고, 피드백을 보내주세요! + +## 다운로드 + +* <{{ release.url.gz }}> + + SIZE: {{ release.size.gz }} + SHA1: {{ release.sha1.gz }} + SHA256: {{ release.sha256.gz }} + SHA512: {{ release.sha512.gz }} + +* <{{ release.url.xz }}> + + SIZE: {{ release.size.xz }} + SHA1: {{ release.sha1.xz }} + SHA256: {{ release.sha256.xz }} + SHA512: {{ release.sha512.xz }} + +* <{{ release.url.zip }}> + + SIZE: {{ release.size.zip }} + SHA1: {{ release.sha1.zip }} + SHA256: {{ release.sha256.zip }} + SHA512: {{ release.sha512.zip }} + +## Ruby는 + +Ruby는 1993년에 Matz(마츠모토 유키히로) 씨가 처음 개발했고, +현재는 오픈 소스로서 개발되고 있습니다. 여러 플랫폼에서 동작하며, +특히 웹 개발에서 전 세계적으로 이용되고 있습니다. From 051c36de1d5785612208b76c9706c20731b8c89a Mon Sep 17 00:00:00 2001 From: Chayoung You Date: Tue, 19 Oct 2021 03:45:16 +0900 Subject: [PATCH 0021/1090] Translate "Ruby 3.0.0 Released" (ko) (#2702) --- .../_posts/2020-12-25-ruby-3-0-0-released.md | 391 ++++++++++++++++++ 1 file changed, 391 insertions(+) create mode 100644 ko/news/_posts/2020-12-25-ruby-3-0-0-released.md diff --git a/ko/news/_posts/2020-12-25-ruby-3-0-0-released.md b/ko/news/_posts/2020-12-25-ruby-3-0-0-released.md new file mode 100644 index 0000000000..4cd4b6628c --- /dev/null +++ b/ko/news/_posts/2020-12-25-ruby-3-0-0-released.md @@ -0,0 +1,391 @@ +--- +layout: news_post +title: "Ruby 3.0.0 릴리스" +author: "naruse" +translator: "yous" +date: 2020-12-25 00:00:00 +0000 +lang: ko +--- + +Ruby 3.0.0 릴리스를 알리게 되어 기쁩니다. 우리는 2015년부터 성능, 동시성, 타입 기능을 목표로 한 Ruby 3을 위해 열심히 개발해 왔습니다. 특히 성능 부분에서, Matz 씨는 "Ruby3는 Ruby2보다 3배 더 빠를 것"이라고 해 [Ruby 3x3](https://blog.heroku.com/ruby-3-by-3)으로 알려지기도 했습니다. + +{% assign release = site.data.releases | where: "version", "3.0.0" | first %} + +Optcarrot 3000 frames + +NES의 게임 에뮬레이션 작업을 통해 싱글 스레드 성능을 측정한 [optcarrot 벤치마크](https://github.com/mame/optcarrot)를 보면, Ruby 2.0보다 3배 더 빠른 성능을 달성했습니다!
이 벤치마크는 [benchmark-driver.github.io/hardware.html](https://benchmark-driver.github.io/hardware.html)에 표기된 환경에서 측정되었습니다. [8c510e4095 커밋](https://github.com/ruby/ruby/commit/8c510e4095)이 Ruby 3.0 코드로 사용되었습니다. 환경과 벤치마크에 따라 3배 빠르지 않을 수도 있습니다.
+ +Ruby 3.0.0의 목표는 다음 항목을 통해 다루고 있습니다. +* 성능 + * MJIT +* 동시성 + * Ractor + * Fiber 스케줄러 +* 타입 (정적 분석) + * RBS + * TypeProf + +위의 성능 향상과 함께, Ruby 3.0에 몇 가지 새 기능이 도입됩니다. + +## 성능 + +> 제가 콘퍼런스 키노트에서 처음 "Ruby3x3"을 선언했을 때, 코어 팀 구성원을 포함한 많은 사람들은 "Matz 씨는 허풍쟁이"라고 느꼈습니다. 사실 저도 그렇게 느꼈어요. 하지만 우리는 해냈습니다. (일부 벤치마크에서) Ruby3.0을 Ruby2.0보다 세 배 빠르게 만드는 데 성공한 코어 팀이 자랑스럽습니다. -- Matz + +### MJIT + +MJIT의 많은 개선이 추가되었습니다. 자세한 내용은 NEWS를 확인하세요. + +Ruby 3.0에서 JIT는 게임([Optcarrot](https://benchmark-driver.github.io/benchmarks/optcarrot/commits.html#chart-1)), AI([Rubykon](https://benchmark-driver.github.io/benchmarks/rubykon/commits.html)), 적은 메서드를 여러 번 호출하는 데 대부분의 시간을 사용하는 애플리케이션 등의 제한적인 작업 성능을 향상시킵니다. + +Ruby 3.0이 [JIT이 적용된 코드 크기를 현저히 줄였지만](https://twitter.com/k0kubun/status/1256142302608650244), Rails와 같은 작업에 대해서는 아직 준비되지 않았습니다. 굉장히 많은 메서드에 시간을 사용하는 Rails의 경우 JIT으로 인해 명령어 캐시 미스가 더 악화됩니다. 이 문제에 대한 추후 개선은 Ruby 3.1 소식을 기다려주세요. + +## 동시성 / 병렬성 + +> 지금은 멀티코어 시대입니다. 동시성은 아주 중요합니다. Ruby는 Ractor, Async Fiber와 함께 진정한 동시성 언어가 될 것입니다. --- Matz + +### Ractor (실험적) + +Ractor는 스레드 안전에 대한 걱정이 없는 병렬 실행을 제공하기 위해 설계된 액터 모델과 비슷한 동시 실행 추상화 모델입니다. + +여러 개의 Ractor를 만들고 병렬로 실행할 수 있습니다. Ractor는 일반 객체를 공유할 수 없기 때문에 스레드 안전한 병렬 프로그램을 만들 수 있습니다. Ractor 간의 통신은 메시지 넘기기를 통해서 지원됩니다. + +객체 공유를 제한하기 위해, Ractor는 Ruby 문법에 여러 제한을 추가했습니다(여러 개의 Ractor를 사용하지 않는다면 제한은 없습니다). + +명세와 구현은 아직 완성되지 않았으므로 앞으로 변경될 수 있습니다. 그러므로 이 기능은 실험적으로 제공되며 처음 `Ractor.new`를 실행하면 "실험적 기능"이라는 경고를 표시합니다. + +다음은 유명한 벤치마크 tak 함수([Tak (function) - Wikipedia](https://en.wikipedia.org/wiki/Tak_(function)))의 실행 시간을 측정하는 작은 프로그램입니다. 4번 순차적으로 실행하거나, Ractor를 통해 4번 병렬로 실행합니다. + +``` ruby +def tarai(x, y, z) = + x <= y ? y : tarai(tarai(x-1, y, z), + tarai(y-1, z, x), + tarai(z-1, x, y)) +require 'benchmark' +Benchmark.bm do |x| + # 순차적 버전 + x.report('seq'){ 4.times{ tarai(14, 7, 0) } } + + # 병렬 버전 + x.report('par'){ + 4.times.map do + Ractor.new { tarai(14, 7, 0) } + end.each(&:take) + } +end +``` + +``` +Benchmark result: + user system total real +seq 64.560736 0.001101 64.561837 ( 64.562194) +par 66.422010 0.015999 66.438009 ( 16.685797) +``` + +이 결과는 Ubuntu 20.04, Intel(R) Core(TM) i7-6700(4 코어, 8 하드웨어 스레드)에서 측정되었습니다. 이는 병렬 버전이 순차적 버전보다 3.87배 빠르다는 것을 보여줍니다. + +더 자세한 내용은 [doc/ractor.md](https://docs.ruby-lang.org/en/3.0.0/doc/ractor_md.html)를 확인하세요. + +### Fiber 스케줄러 + +블로킹 작업에 끼어들 수 있는 `Fiber#scheduler`가 도입됩니다. 이는 기존에 존재하는 코드를 변경하지 않고 가벼운 동시성을 지원할 수 있게 합니다. 어떻게 동작하는지 궁금하다면 ["Don't Wait For Me, Scalable Concurrency for Ruby 3"](https://www.youtube.com/watch?v=Y29SSOS4UOc)을 보세요. + +현재 지원되는 클래스와 메서드는 다음과 같습니다. + +- `Mutex#lock`, `Mutex#unlock`, `Mutex#sleep` +- `ConditionVariable#wait` +- `Queue#pop`, `SizedQueue#push` +- `Thread#join` +- `Kernel#sleep` +- `Process.wait` +- `IO#wait`, `IO#read`, `IO#write`와 관련 메서드(예: `#wait_readable`, `#gets`, `#puts` 등). +- `IO#select`는 *지원되지 않습니다*. + +이 예제 프로그램은 HTTP 요청 몇 개를 동시에 수행합니다. + +``` ruby +require 'async' +require 'net/http' +require 'uri' + +Async do + ["ruby", "rails", "async"].each do |topic| + Async do + Net::HTTP.get(URI "https://www.google.com/search?q=#{topic}") + end + end +end +``` + +이 코드는 이벤트 루프를 지원하는 [async](https://github.com/socketry/async)를 사용합니다. 이 이벤트 루프는 `Net::HTTP`를 논블로킹 작업으로 만들기 위해 `Fiber#scheduler` 훅을 사용합니다. Ruby의 논블로킹 실행을 제공하기 위해 다른 gem도 이 인터페이스를 사용할 수 있습니다. 그리고 이러한 gem은 논블로킹 훅을 지원하는 Ruby의 다른 구현체(예: JRuby, TruffleRuby)와도 호환됩니다. + +## 정적 분석 + +> 2010년대는 정적 타입 프로그래밍 언어의 시대였습니다. Ruby는 추상 해석을 통해, 타입 선언 없이 정적 타입 체크를 하여 미래를 추구합니다. RBS와 TypeProf는 미래를 향한 첫걸음입니다. 다음 단계도 기대해주세요. --- Matz + +### RBS + +RBS는 Ruby 프로그램의 타입을 기술하기 위한 언어입니다. + +TypeProf와 다른 도구들을 포함해서, RBS를 지원하는 타입 검사기는 RBS 정의를 통해 Ruby 프로그램을 더 잘 이해합니다. + +클래스나 모듈에 정의된 메서드, 인스턴스 변수와 타입, 상속이나 믹스인 관계에 대한 정의를 작성할 수 있습니다. + +RBS의 목표는 Ruby 프로그램에서 흔히 보이는 패턴을 지원하는 것과 유니언 타입, 메서드 오버로딩, 제네릭을 포함하는 고급 타입을 작성할 수 있도록 하는 것입니다. 또한 _인터페이스 타입_을 이용해 덕타이핑을 지원합니다. + +Ruby 3.0은 RBS로 작성된 타입 정의를 해석하고 처리하는 `rbs` gem을 포함합니다. +다음은 클래스, 모듈, 상수 정의를 포함하는 RBS의 작은 예시입니다. + +``` rbs +module ChatApp + VERSION: String + class Channel + attr_reader name: String + attr_reader messages: Array[Message] + attr_reader users: Array[User | Bot] # `|`는 유니언 타입을 의미합니다. 여기에서는 `User` 또는 `Bot`이라는 의미입니다. + def initialize: (String) -> void + def post: (String, from: User | Bot) -> Message # 메서드 오버로딩을 지원합니다. + | (File, from: User | Bot) -> Message + end +end +``` + +더 자세한 내용은 [rbs gem의 README](https://github.com/ruby/rbs)를 확인하세요. + +### TypeProf + +TypeProf는 Ruby 패키지에 포함된 타입 분석 도구입니다. + +지금의 TypeProf는 타입 추론 도구 역할을 합니다. + +TypeProf는 타입 어노테이션이 없는 일반적인 Ruby 코드를 읽어서, 어떤 메서드가 정의되어 있고 어떻게 사용되는지 분석하고, RBS 형식으로 타입 시그니처의 프로토타입을 생성합니다. + +다음은 TypeProf의 간단한 데모입니다. + +예제 입력입니다. + +``` ruby +# test.rb +class User + def initialize(name:, age:) + @name, @age = name, age + end + attr_reader :name, :age +end +User.new(name: "John", age: 20) +``` + +예제 출력입니다. + +``` +$ typeprof test.rb +# Classes +class User + attr_reader name : String + attr_reader age : Integer + def initialize : (name: String, age: Integer) -> [String, Integer] +end +``` + +입력을 "test.rb"에 저장하고 "typeprof test.rb" 커맨드를 통해 TypeProf를 실행할 수 있습니다. + +[TypeProf를 온라인에서 사용](https://mame.github.io/typeprof-playground/#rb=%23+test.rb%0Aclass+User%0A++def+initialize%28name%3A%2C+age%3A%29%0A++++%40name%2C+%40age+%3D+name%2C+age%0A++end%0A++%0A++attr_reader+%3Aname%2C+%3Aage%0Aend%0A%0AUser.new%28name%3A+%22John%22%2C+age%3A+20%29&rbs=)해볼 수도 있습니다. (TypeProf를 서버 쪽에서 실행하는 거라서, 잠시 동작하지 않을 수도 있습니다!) + +더 자세한 내용은 [TypeProf 문서](https://github.com/ruby/typeprof/blob/master/doc/doc.md)와 [데모](https://github.com/ruby/typeprof/blob/master/doc/demo.md)를 확인하세요. + +TypeProf는 실험적이고 아직 완성되지 않았습니다. Ruby 언어의 일부만 지원되고, 타입 오류 감지 기능은 제한적입니다. 하지만 언어 기능의 지원 범위, 분석 성능, 사용성이 빠르게 개선되고 있는 중입니다. 어떤 종류의 피드백이든 환영합니다. + +## 그 이외의 주목할 만한 기능 + +* 한 줄 패턴 매칭을 재설계했습니다. (실험적) + + * `=>`가 추가됩니다. 오른 방향 대입처럼 사용할 수 있습니다. + + ```ruby + 0 => a + p a #=> 0 + + {b: 0, c: 1} => {b:} + p b #=> 0 + ``` + + * `in`이 `true` 또는 `false`를 반환하도록 변경됩니다. + + ```ruby + # 버전 3.0 + 0 in 1 #=> false + + # 버전 2.7 + 0 in 1 #=> raise NoMatchingPatternError + ``` + +* 검색 패턴이 추가됩니다. (실험적) + + ``` ruby + case ["a", 1, "b", "c", 2, "d", "e", "f", 3] + in [*pre, String => x, String => y, *post] + p pre #=> ["a", 1] + p x #=> "b" + p y #=> "c" + p post #=> [2, "d", "e", "f", 3] + end + ``` + +* end 없는 메서드 정의가 추가됩니다. + + ``` ruby + def square(x) = x * x + ``` + +* `Hash#except`가 내장됩니다. + + ``` ruby + h = { a: 1, b: 2, c: 3 } + p h.except(:a) #=> {:b=>2, :c=>3} + ``` + +* 메모리 뷰가 실험적인 기능으로 추가됩니다. + + * 이는 숫자 배열이나 비트맵 이미지와 같은 메모리 공간을 확장 라이브러리 간에 교환하기 위한 새로운 C-API 집합입니다. 확장 라이브러리는 모양, 요소의 형식 등으로 구성된 메모리 공간의 메타데이터를 공유할 수 있습니다. 이러한 메타데이터를 사용하여 확장 라이브러리는 다차원 배열을 적절하게 공유할 수 있습니다. 이 기능은 Python의 버퍼 프로토콜을 참고하여 설계되었습니다. + +## 성능 향상 + +* IRB에 긴 코드를 붙여 넣는 속도가 Ruby 2.7.0에 포함된 버전보다 53배 빨라졌습니다. 예를 들어, [이 샘플 코드](https://gist.github.com/aycabta/30ab96334275bced5796f118c9220b0b)를 붙여 넣는 데 드는 시간이 11.7초에서 0.22초로 줄어들었습니다. + + + + + +* IRB에 `measure` 커맨드가 추가되었습니다. 간단한 실행 시간 측정이 가능합니다. + + ``` + irb(main):001:0> 3 + => 3 + irb(main):002:0> measure + TIME is added. + => nil + irb(main):003:0> 3 + processing time: 0.000058s + => 3 + irb(main):004:0> measure :off + => nil + irb(main):005:0> 3 + => 3 + ``` + +## 그 이외의 2.7 이후로 주목할 만한 변경 + +* 키워드 인자가 다른 인자들로부터 분리됩니다. + * 원칙적으로 Ruby 2.7에서 경고를 출력하는 코드는 동작하지 않습니다. 자세한 내용은 [이 문서](https://www.ruby-lang.org/en/news/2019/12/12/separation-of-positional-and-keyword-arguments-in-ruby-3-0/)를 확인하세요. + * 한편, 인자를 전달할 때 앞쪽 인자를 사용할 수 있습니다. + + ``` ruby + def method_missing(meth, ...) + send(:"do_#{ meth }", ...) + end + ``` + +* 패턴 매칭(`case`/`in`)은 이제 실험적이지 않습니다. + * 더 자세한 내용은 [패턴 매칭 문서](https://docs.ruby-lang.org/en/3.0.0/doc/syntax/pattern_matching_rdoc.html)를 확인하세요. +* `$SAFE` 기능이 완전히 제거됩니다. 이 값은 이제 일반 전역 변수입니다. +* Ruby 2.5에서 백트레이스의 순서가 역순이 되었습니다만, 이를 취소합니다. 이제 백트레이스는 Ruby 2.4처럼 동작합니다. 예외가 발생한 곳의 오류 메시지와 줄 번호가 가장 먼저 출력되며, 이를 호출한 곳의 정보가 그 뒤에 출력됩니다. +* 표준 라이브러리를 업데이트했습니다. + * RubyGems 3.2.3 + * Bundler 2.2.3 + * IRB 1.3.0 + * Reline 0.2.0 + * Psych 3.3.0 + * JSON 2.5.1 + * BigDecimal 3.0.0 + * CSV 3.1.9 + * Date 3.1.0 + * Digest 3.0.0 + * Fiddle 1.0.6 + * StringIO 3.0.0 + * StringScanner 3.0.0 + * 등 +* 다음 라이브러리는 이제 내장 gem이나 표준 라이브러리가 아닙니다. + 각 기능이 필요한 경우에는 해당하는 gem을 설치해주세요. + * sdbm + * webrick + * net-telnet + * xmlrpc +* 다음 기본 gem은 이제 내장 gem이 됩니다. + * rexml + * rss +* 다음 표준 라이브러리가 기본 gem이 되고, rubygems.org에 배포됩니다. + * English + * abbrev + * base64 + * drb + * debug + * erb + * find + * net-ftp + * net-http + * net-imap + * net-protocol + * open-uri + * optparse + * pp + * prettyprint + * resolv-replace + * resolv + * rinda + * set + * securerandom + * shellwords + * tempfile + * tmpdir + * time + * tsort + * un + * weakref + * digest + * io-nonblock + * io-wait + * nkf + * pathname + * syslog + * win32ole + +더 자세한 내용은 [NEWS](https://github.com/ruby/ruby/blob/{{ release.tag }}/NEWS.md)나 +[커밋 로그](https://github.com/ruby/ruby/compare/v2_7_0...{{ release.tag }})를 +확인해주세요. + +이러한 변경사항에 따라, Ruby 2.7.0 이후로 [파일 {{ release.stats.files_changed }}개 수정, {{ release.stats.insertions }}줄 추가(+), {{ release.stats.deletions }}줄 삭제(-)](https://github.com/ruby/ruby/compare/v2_7_0...{{ release.tag }}#file_bucket)가 +이루어졌습니다! + +> Ruby3.0은 마일스톤입니다. 언어는 진화했고, 호환성은 유지했습니다. 이게 끝이 아닙니다. Ruby는 계속 진보하고, 더 대단해질 것입니다. 기대해주세요! --- Matz + +메리 크리스마스, 해피 홀리데이, Ruby 3.0과 함께 프로그래밍을 즐겨보세요! + +## 다운로드 + +* <{{ release.url.gz }}> + + SIZE: {{ release.size.gz }} + SHA1: {{ release.sha1.gz }} + SHA256: {{ release.sha256.gz }} + SHA512: {{ release.sha512.gz }} + +* <{{ release.url.xz }}> + + SIZE: {{ release.size.xz }} + SHA1: {{ release.sha1.xz }} + SHA256: {{ release.sha256.xz }} + SHA512: {{ release.sha512.xz }} + +* <{{ release.url.zip }}> + + SIZE: {{ release.size.zip }} + SHA1: {{ release.sha1.zip }} + SHA256: {{ release.sha256.zip }} + SHA512: {{ release.sha512.zip }} + +## Ruby는 + +Ruby는 1993년에 Matz(마츠모토 유키히로) 씨가 처음 개발했고, +현재는 오픈 소스로서 개발되고 있습니다. 여러 플랫폼에서 동작하며, +특히 웹 개발에서 전 세계적으로 이용되고 있습니다. From 0820b1a5e6b9a0c3e33d89bcb906d2d01fa7d7a1 Mon Sep 17 00:00:00 2001 From: Benson Muite Date: Tue, 19 Oct 2021 10:04:05 +0300 Subject: [PATCH 0022/1090] Add OnRuby OnRuby is a meetup alternative written in Ruby --- en/community/user-groups/index.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/en/community/user-groups/index.md b/en/community/user-groups/index.md index f7d7f62266..b6b610d497 100644 --- a/en/community/user-groups/index.md +++ b/en/community/user-groups/index.md @@ -27,6 +27,11 @@ Information about Ruby user groups can be found on various websites: including: private forums, a place for announcements, automated meeting reminders, and a nice RSVP system. +[OnRuby][2] +: A number of user groups can also be found at OnRuby. OnRuby is an + open source platform written in Ruby that can be used to organize + meetups. It is available on [GitHub][3]. + ### Organizing Your Own Group If you are interested in forming your own group, be sure to find out if @@ -37,3 +42,5 @@ option if there is already one nearby. [1]: https://ruby.meetup.com +[2]: https://www.onruby.eu/ +[3]: https://github.com/phoet/on_ruby From 89a49070ea0e7875922893911fb8069a1908d7f0 Mon Sep 17 00:00:00 2001 From: Andrias Meisyal Date: Wed, 20 Oct 2021 16:11:05 +0700 Subject: [PATCH 0023/1090] Translate CVE-2021-28965: XML round-trip vulnerability in REXML (id) --- ...p-vulnerability-in-rexml-cve-2021-28965.md | 51 +++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 id/news/_posts/2021-04-05-xml-round-trip-vulnerability-in-rexml-cve-2021-28965.md diff --git a/id/news/_posts/2021-04-05-xml-round-trip-vulnerability-in-rexml-cve-2021-28965.md b/id/news/_posts/2021-04-05-xml-round-trip-vulnerability-in-rexml-cve-2021-28965.md new file mode 100644 index 0000000000..5aba3104e9 --- /dev/null +++ b/id/news/_posts/2021-04-05-xml-round-trip-vulnerability-in-rexml-cve-2021-28965.md @@ -0,0 +1,51 @@ +--- +layout: news_post +title: "CVE-2021-28965: Kerentanan XML round-trip pada REXML" +author: "mame" +translator: "meisyal" +date: 2021-04-05 12:00:00 +0000 +tags: security +lang: id +--- + +Ada sebuah kerentanan XML *round-trip* pada *gem* REXML yang di-*bundle* +dengan Ruby. Kerentanan ini telah ditetapkan sebagai penanda +[CVE-2021-28965](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-28965). +Kami sangat merekomendasikan untuk memperbarui *gem* REXML. + +## Detail + +Ketika *parsing* dan *serializing* sebuah dokumen XML, *gem* REXML (termasuk +yang di-*bundle* dengan Ruby) dapat membuat sebuah dokumen XML yang salah +di mana struktur dokumen berbeda dengan aslinya. Dampak dari masalah ini sangat +bergantung dengan konteks, tetapi ini bisa menyebabkan kerentanan pada beberapa +program yang menggunakan REXML. + +Mohon perbarui *gem* REXML ke versi 3.2.5 atau setelahnya. + +Jika Anda sedang menggunakan Ruby 2.6 atau setelahnya: + +* Mohon gunakan Ruby 2.6.7, 2.7.3, atau 3.0.1. +* Kemungkinan lain, Anda dapat menjalankan `gem update rexml` untuk memperbarui. Jika Anda menggunakan *bundler*, mohon tambahkan `gem "rexml", ">= 3.2.5"` pada `Gemfile`. + +Jika Anda sedang menggunakan Ruby 2.5.8 atau sebelumnya: + +* Mohon gunakan Ruby 2.5.9. +* Anda tidak dapat menjalankan `gem update rexml` pada Ruby 2.5.8 atau sebelumnya. +* Catat bahwa rangkaian Ruby 2.5 saat ini EOL, sehingga pertimbangkan untuk memperbarui ke 2.6.7 atau setelahnya segera mungkin. + +## Versi terimbas + +* Ruby 2.5.8 atau sebelumnya (Anda tidak dapat menjalankan `gem upgrade rexml` pada versi ini.) +* Ruby 2.6.6 atau sebelumnya +* Ruby 2.7.2 atau sebelumnya +* Ruby 3.0.0 +* *Gem* REXML 3.2.4 atau sebelumnya + +## Rujukan + +Terima kasih kepada [Juho Nurminen](https://hackerone.com/jupenur) yang telah menemukan masalah ini. + +## Riwayat + +* Semula dipublikasikan pada 2021-04-05 12:00:00 (UTC) From 9564fa74948b75b3b5aa05de5c9a7686ca7e600b Mon Sep 17 00:00:00 2001 From: Andrias Meisyal Date: Wed, 20 Oct 2021 16:17:16 +0700 Subject: [PATCH 0024/1090] Translate Ruby 2.6.7 released news (id) (#2661) * Translate Ruby 2.6.7 released news (id) * Fix link to translated CVE-2021-28965 post (id) --- .../_posts/2021-04-05-ruby-2-6-7-released.md | 69 +++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 id/news/_posts/2021-04-05-ruby-2-6-7-released.md diff --git a/id/news/_posts/2021-04-05-ruby-2-6-7-released.md b/id/news/_posts/2021-04-05-ruby-2-6-7-released.md new file mode 100644 index 0000000000..9eb9e5ef3f --- /dev/null +++ b/id/news/_posts/2021-04-05-ruby-2-6-7-released.md @@ -0,0 +1,69 @@ +--- +layout: news_post +title: "Ruby 2.6.7 Dirilis" +author: "usa" +translator: "meisyal" +date: 2021-04-05 12:00:00 +0000 +lang: id +--- + +Ruby 2.6.7 telah dirilis. + +Rilis ini memuat perbaikan keamanan. +Mohon cek topik-topik di bawah ini untuk lebih detail. + +* [CVE-2020-25613: Potensi Kerentanan HTTP Request Smuggling pada WEBrick]({%link id/news/_posts/2020-09-29-http-request-smuggling-cve-2020-25613.md %}) +* [CVE-2021-28965: XML round-trip vulnerability in REXML]({% link id/news/_posts/2021-04-05-xml-round-trip-vulnerability-in-rexml-cve-2021-28965.md %}) + +Lihat [commit logs](https://github.com/ruby/ruby/compare/v2_6_6...v2_6_7) untuk +detail. + +Dengan rilis ini, kami mengakhiri fase perawatan dari Ruby 2.6 dan Ruby 2.6 +masuk ke fase perawatan keamanan. +Ini berarti kami tidak akan melakukan *backport* perbaikan *bug* apapun pada +Ruby 2.6, kecuali perbaikan keamanan. +Masa perawatan keamanan dijadwalkan selama satu tahun. +Ruby 2.6 mencapai EOL dan dukungan resminya berakhir saat fase perawatan +keamanan selesai. +Oleh sebab itu, kami menyarankan Anda untuk merencanakan pembaruan ke +Ruby 2.7 atau 3.0. + +## Unduh + +{% assign release = site.data.releases | where: "version", "2.6.7" | first %} + +* <{{ release.url.bz2 }}> + + SIZE: {{ release.size.bz2 }} + SHA1: {{ release.sha1.bz2 }} + SHA256: {{ release.sha256.bz2 }} + SHA512: {{ release.sha512.bz2 }} + +* <{{ release.url.gz }}> + + SIZE: {{ release.size.gz }} + SHA1: {{ release.sha1.gz }} + SHA256: {{ release.sha256.gz }} + SHA512: {{ release.sha512.gz }} + +* <{{ release.url.xz }}> + + SIZE: {{ release.size.xz }} + SHA1: {{ release.sha1.xz }} + SHA256: {{ release.sha256.xz }} + SHA512: {{ release.sha512.xz }} + +* <{{ release.url.zip }}> + + SIZE: {{ release.size.zip }} + SHA1: {{ release.sha1.zip }} + SHA256: {{ release.sha256.zip }} + SHA512: {{ release.sha512.zip }} + +## Komentar Rilis + +Banyak *committer*, pengembang, dan pengguna yang telah menyediakan laporan +*bug* membantu kami membuat rilis ini. Terima kasih atas kontribusinya. + +Perawatan Ruby 2.6, termasuk rilis ini, didasarkan pada "Agreement for the Ruby +stable version" dari Ruby Associaction. From 84747dc70d2d5884ffe4535015d0b0888a01f2c6 Mon Sep 17 00:00:00 2001 From: Andrias Meisyal Date: Fri, 22 Oct 2021 22:57:00 +0700 Subject: [PATCH 0025/1090] Translate Ruby 2.7.3 released news post (id) --- .../_posts/2021-04-05-ruby-2-7-3-released.md | 56 +++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 id/news/_posts/2021-04-05-ruby-2-7-3-released.md diff --git a/id/news/_posts/2021-04-05-ruby-2-7-3-released.md b/id/news/_posts/2021-04-05-ruby-2-7-3-released.md new file mode 100644 index 0000000000..72ab593135 --- /dev/null +++ b/id/news/_posts/2021-04-05-ruby-2-7-3-released.md @@ -0,0 +1,56 @@ +--- +layout: news_post +title: "Ruby 2.7.3 Dirilis" +author: "nagachika" +translator: "meisyal" +date: 2021-04-05 12:00:00 +0000 +lang: id +--- + +Ruby 2.7.3 telah dirilis. + +Rilis ini mencakup perbaikan keamanan. +Mohon cek topik-topik di bawah ini untuk lebih detail. + +* [CVE-2021-28965: Kerentanan XML round-trip pada REXML]({% link id/news/_posts/2021-04-05-xml-round-trip-vulnerability-in-rexml-cve-2021-28965.md %}) +* [CVE-2021-28966: Path traversal in Tempfile on Windows]({% link en/news/_posts/2021-04-05-tempfile-path-traversal-on-windows-cve-2021-28966.md %}) + +Cek [commit logs](https://github.com/ruby/ruby/compare/v2_7_2...v2_7_3) untuk +detail. + +## Unduh + +{% assign release = site.data.releases | where: "version", "2.7.3" | first %} + +* <{{ release.url.bz2 }}> + + SIZE: {{ release.size.bz2 }} + SHA1: {{ release.sha1.bz2 }} + SHA256: {{ release.sha256.bz2 }} + SHA512: {{ release.sha512.bz2 }} + +* <{{ release.url.gz }}> + + SIZE: {{ release.size.gz }} + SHA1: {{ release.sha1.gz }} + SHA256: {{ release.sha256.gz }} + SHA512: {{ release.sha512.gz }} + +* <{{ release.url.xz }}> + + SIZE: {{ release.size.xz }} + SHA1: {{ release.sha1.xz }} + SHA256: {{ release.sha256.xz }} + SHA512: {{ release.sha512.xz }} + +* <{{ release.url.zip }}> + + SIZE: {{ release.size.zip }} + SHA1: {{ release.sha1.zip }} + SHA256: {{ release.sha256.zip }} + SHA512: {{ release.sha512.zip }} + +## Komentar Rilis + +Banyak *committer*, pengembang, dan pengguna yang menyediakan laporan *bug* +telah membantu kami membuat rilis ini. Terima kasih atas kontribusinya. From 5dd6e5f7629c665a1d1447a22d7b4960abf9e608 Mon Sep 17 00:00:00 2001 From: Chayoung You Date: Sat, 23 Oct 2021 14:12:46 +0900 Subject: [PATCH 0026/1090] Add Ruby Discord Server (ko) (#2706) --- ko/community/index.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/ko/community/index.md b/ko/community/index.md index 2bcecc4ee9..cdf5a45da6 100644 --- a/ko/community/index.md +++ b/ko/community/index.md @@ -27,6 +27,11 @@ Ruby의 장점, 특징에 대한 설명에서 빠지지 않고 등장하는 것 : Ruby는 여러 언어에 걸쳐 다른 주제를 다루는 다양한 메일링 리스트를 가지고 있습니다. Ruby에 관해 질문이 있다면, 메일링 리스트에 질문하시면 됩니다. +[Ruby Discord 서버 (초대 링크)][ruby-discord] +: Ruby 언어 Discord 서버에서 다른 Ruby 사용자와 채팅하고, Ruby 질문을 통해 + 도움을 받고, 다른 사람을 도울 수 있습니다. + Discord는 초보 개발자가 시작하기 좋은 곳이고, 참여하기도 쉽습니다. + [IRC에서의 Ruby(#ruby)](https://web.libera.chat/#ruby) : Ruby 언어 IRC 채널에서 동료 루비스트와 채팅할 수 있습니다. @@ -54,5 +59,6 @@ Ruby의 장점, 특징에 대한 설명에서 빠지지 않고 등장하는 것 * [Rails at Open Directory Project][rails-opendir] [ruby-central]: http://rubycentral.org/ +[ruby-discord]: https://discord.gg/EnSevaRfct [ruby-opendir]: https://dmoztools.net/Computers/Programming/Languages/Ruby/ [rails-opendir]: https://dmoztools.net/Computers/Programming/Languages/Ruby/Software/Frameworks/Rails/ From 9b6a8c486c1513c81b4fa2620b0ddb808b3eaa9d Mon Sep 17 00:00:00 2001 From: Andrias Meisyal Date: Sat, 23 Oct 2021 17:52:29 +0700 Subject: [PATCH 0027/1090] Translate CVE-2021-28966: Path traversal in Tempfile on Windows (id) --- ...ath-traversal-on-windows-cve-2021-28966.md | 44 +++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 id/news/_posts/2021-04-05-tempfile-path-traversal-on-windows-cve-2021-28966.md diff --git a/id/news/_posts/2021-04-05-tempfile-path-traversal-on-windows-cve-2021-28966.md b/id/news/_posts/2021-04-05-tempfile-path-traversal-on-windows-cve-2021-28966.md new file mode 100644 index 0000000000..34e5531b31 --- /dev/null +++ b/id/news/_posts/2021-04-05-tempfile-path-traversal-on-windows-cve-2021-28966.md @@ -0,0 +1,44 @@ +--- +layout: news_post +title: "CVE-2021-28966: Path traversal pada Tempfile di Windows" +author: "mame" +translator: "meisyal" +date: 2021-04-05 12:00:00 +0000 +tags: security +lang: id +--- + +Ada sebuah keretanan pembuatan direktori secara tidak sengaja pada pustaka +*tmpdir* yang di-*bundle* dengan Ruby di Windows. Selain itu, ada juga +kerentanan pembuatan berkas secara tidak sengaja pada pustaka *tempfile* yang +di-*bundle* dengan Ruby di Windows. Kerentanan ini telah ditetapkan sebagai +penanda [CVE-2021-28966](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-28966). + +## Detail + +*Method* `Dir.mktmpdir` yang dikenalkan oleh pustaka *tmpdir* menerima prefiks +dan sufiks dari direktori yang akan dibuat pada parameter pertama. Prefiks dapat +berisi penentu direktori relatif `"..\\"`, sehingga *method* ini dapat +digunakan untuk mengarahkan ke direktori manapun. Jika sebuah *script* menerima +masukan dari luar sebagai prefiks dan sasaran direktori tidak memiliki izin +semestinya atau Ruby tidak memiliki hak akses, penyerang dapat membuat +sebuah direktori atau berkas pada direktori manapun. + +Ini adalah isu yang sama pada [CVE-2018-6914](https://www.ruby-lang.org/id/news/2018/03/28/unintentional-file-and-directory-creation-with-directory-traversal-cve-2018-6914/), tetapi perbaikan +sebelumnya belum mencakup Windows. + +Semua pengguna yang terimbas dengan rilis seharusnya memperbarui segera. + +## Versi terimbas + +* Ruby 2.7.2 atau sebelumnya +* Ruby 3.0.0 + +## Rujukan + +Terima kasih kepada [Bugdiscloseguys](https://hackerone.com/bugdiscloseguys) +yang telah menemukan isu ini. + +## Riwayat + +* Semula dipublikasikan pada 2021-04-05 12:00:00 (UTC) From e0ad42b4d86c3e95cc8bf65fd0b4f9bde512d493 Mon Sep 17 00:00:00 2001 From: OKURA Masafumi Date: Mon, 25 Oct 2021 14:55:51 +0900 Subject: [PATCH 0028/1090] Add `Slack` section to ja We mention Discord community in en page, so I think it's fine to mention Slack community. Modifying the expression is welcome. --- ja/community/index.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ja/community/index.md b/ja/community/index.md index c26e7feab4..51e8626994 100644 --- a/ja/community/index.md +++ b/ja/community/index.md @@ -40,6 +40,10 @@ Rubyコミュニティに興味があるのなら、ぜひ以下のコミュニ * Libera Chatの[#ruby](https://web.libera.chat/#ruby) * Rubyの利用者の交流、質問のためのチャンネルです。(英語) +## Slack + +* Slack上には[ruby-jp](https://ruby-jp.github.io/)コミュニティがあります。3000人を超えるユーザーと100を超えるチャンネルが存在し、初歩的な質問からCRubyについての高度な質問まで、多種多様な質問と回答が飛び交っています。 + ## メーリングリスト * [メーリングリスト](/ja/community/mailing-lists/) のページを参照してください。 From eb12cdb2bec96f72228728778a0cee19edea5a32 Mon Sep 17 00:00:00 2001 From: Andrias Meisyal Date: Mon, 25 Oct 2021 23:34:17 +0700 Subject: [PATCH 0029/1090] Translate Ruby 3.0.1 released news (id) --- .../_posts/2021-04-05-ruby-3-0-1-released.md | 49 +++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 id/news/_posts/2021-04-05-ruby-3-0-1-released.md diff --git a/id/news/_posts/2021-04-05-ruby-3-0-1-released.md b/id/news/_posts/2021-04-05-ruby-3-0-1-released.md new file mode 100644 index 0000000000..282f9a5822 --- /dev/null +++ b/id/news/_posts/2021-04-05-ruby-3-0-1-released.md @@ -0,0 +1,49 @@ +--- +layout: news_post +title: "Ruby 3.0.1 Dirilis" +author: "naruse" +translator: "meisyal" +date: 2021-04-05 12:00:00 +0000 +lang: id +--- + +Ruby 3.0.1 telah dirilis. + +Rilis ini memuat perbaikan keamanan. +Mohon cek topik-topik di bawah ini untuk lebih detail. + +* [CVE-2021-28965: Kerentanan XML round-trip pada REXML]({% link id/news/_posts/2021-04-05-xml-round-trip-vulnerability-in-rexml-cve-2021-28965.md %}) +* [CVE-2021-28966: Path traversal in Tempfile on Windows]({% link en/news/_posts/2021-04-05-tempfile-path-traversal-on-windows-cve-2021-28966.md %}) + +Lihat [commit logs](https://github.com/ruby/ruby/compare/v3_0_0...v3_0_1) +untuk detail. + +## Unduh + +{% assign release = site.data.releases | where: "version", "3.0.1" | first %} + +* <{{ release.url.gz }}> + + SIZE: {{ release.size.gz }} + SHA1: {{ release.sha1.gz }} + SHA256: {{ release.sha256.gz }} + SHA512: {{ release.sha512.gz }} + +* <{{ release.url.xz }}> + + SIZE: {{ release.size.xz }} + SHA1: {{ release.sha1.xz }} + SHA256: {{ release.sha256.xz }} + SHA512: {{ release.sha512.xz }} + +* <{{ release.url.zip }}> + + SIZE: {{ release.size.zip }} + SHA1: {{ release.sha1.zip }} + SHA256: {{ release.sha256.zip }} + SHA512: {{ release.sha512.zip }} + +## Komentar Rilis + +Banyak *committer*, pengembang, dan pengguna yang menyediakan laporan *bug* +telah membantu kami membuat rilis ini. Terima kasih atas kontribusinya. From d81b47c8261ec7aa1ce81acc1f48c0225384d402 Mon Sep 17 00:00:00 2001 From: Hiroshi SHIBATA Date: Tue, 26 Oct 2021 12:48:58 +0900 Subject: [PATCH 0030/1090] Fixed markdown style and Removed trailing whitespaces --- en/community/user-groups/index.md | 4 +--- zh_tw/news/_posts/2020-04-05-support-of-ruby-2-4-has-ended.md | 4 ++-- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/en/community/user-groups/index.md b/en/community/user-groups/index.md index b6b610d497..fb346e14d0 100644 --- a/en/community/user-groups/index.md +++ b/en/community/user-groups/index.md @@ -31,7 +31,7 @@ Information about Ruby user groups can be found on various websites: : A number of user groups can also be found at OnRuby. OnRuby is an open source platform written in Ruby that can be used to organize meetups. It is available on [GitHub][3]. - + ### Organizing Your Own Group If you are interested in forming your own group, be sure to find out if @@ -39,8 +39,6 @@ there is already a Ruby user group in your area. Larger meetings are usually much more fun, so starting your own group may not be the best option if there is already one nearby. - - [1]: https://ruby.meetup.com [2]: https://www.onruby.eu/ [3]: https://github.com/phoet/on_ruby diff --git a/zh_tw/news/_posts/2020-04-05-support-of-ruby-2-4-has-ended.md b/zh_tw/news/_posts/2020-04-05-support-of-ruby-2-4-has-ended.md index 0dfe1bbb6b..2e8a9ac8eb 100644 --- a/zh_tw/news/_posts/2020-04-05-support-of-ruby-2-4-has-ended.md +++ b/zh_tw/news/_posts/2020-04-05-support-of-ruby-2-4-has-ended.md @@ -12,10 +12,10 @@ Ruby 2.4 系列的官方支持終了期間之宣布。 昨年 4 月以來的 1 年間、Ruby 2.4系列處於安全維護期。正如先前所宣布的,官方支持將於2020年3月31日結束。 之後,有簡單的錯誤修復或者即使發現安全問題,也不會針對Ruby 2.4系列發布新版本。 -2020年3月31日,Ruby 2.4系列的最終版本2.4.10發布,這只是為了讓使用者更有時間轉移到較新的版本系列。 +2020年3月31日,Ruby 2.4系列的最終版本2.4.10發布,這只是為了讓使用者更有時間轉移到較新的版本系列。 如果您當前正在使用Ruby 2.4系列,請盡快轉換到較新的版本系列。 -##關於當前支持的版本系列 +## 關於當前支持的版本系列 ### Ruby 2.7系列 From dcf83f9163a8966c43c7382cd90d3b9b63a36d0f Mon Sep 17 00:00:00 2001 From: Hiroshi SHIBATA Date: Tue, 26 Oct 2021 12:55:13 +0900 Subject: [PATCH 0031/1090] Bump Ruby version to 2.7.4 --- Gemfile | 2 +- Gemfile.lock | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Gemfile b/Gemfile index 43685579d2..945407efd2 100644 --- a/Gemfile +++ b/Gemfile @@ -1,6 +1,6 @@ source "https://rubygems.org" -ruby "~> 2.7.2" +ruby "~> 2.7.4" gem "rake" gem "jekyll", "~> 4.0" diff --git a/Gemfile.lock b/Gemfile.lock index ad1dd77348..2274054e6c 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -114,7 +114,7 @@ DEPENDENCIES validate-website (~> 1.6) RUBY VERSION - ruby 2.7.2p137 + ruby 2.7.4p191 BUNDLED WITH 2.1.4 From 8f1aee23f6905e2aeb7e71e37a7649a5a7ea5070 Mon Sep 17 00:00:00 2001 From: Hiroshi SHIBATA Date: Tue, 26 Oct 2021 13:10:26 +0900 Subject: [PATCH 0032/1090] update bundles --- Gemfile.lock | 39 ++++++++++++++++++++++----------------- 1 file changed, 22 insertions(+), 17 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 2274054e6c..cd9f3c69bd 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -4,18 +4,18 @@ GEM addressable (2.8.0) public_suffix (>= 2.0.2, < 5.0) colorator (1.1.0) - concurrent-ruby (1.1.7) + concurrent-ruby (1.1.9) crass (1.0.6) em-websocket (0.5.2) eventmachine (>= 0.12.9) http_parser.rb (~> 0.6.0) eventmachine (1.2.7) - ffi (1.14.2) + ffi (1.15.4) forwardable-extended (2.6.0) http_parser.rb (0.6.0) - i18n (1.8.5) + i18n (1.8.10) concurrent-ruby (~> 1.0) - jekyll (4.2.0) + jekyll (4.2.1) addressable (~> 2.4) colorator (~> 1.0) em-websocket (~> 0.5) @@ -34,8 +34,8 @@ GEM sassc (> 2.0.1, < 3.0) jekyll-watch (2.2.1) listen (~> 3.0) - json (2.5.1) - kgio (2.11.3) + json (2.6.1) + kgio (2.11.4) kramdown (2.3.1) rexml kramdown-parser-gfm (1.1.0) @@ -44,58 +44,63 @@ GEM jekyll (>= 2.0) rack (>= 1.6, < 3.0) liquid (4.0.3) - listen (3.3.3) + listen (3.7.0) rb-fsevent (~> 0.10, >= 0.10.3) rb-inotify (~> 0.9, >= 0.9.10) mercenary (0.4.0) mini_portile2 (2.6.1) - minitest (5.14.2) + minitest (5.14.4) nokogiri (1.12.5) mini_portile2 (~> 2.6.1) racc (~> 1.4) + nokogumbo (2.0.5) + nokogiri (~> 1.8, >= 1.8.4) paint (2.2.1) pathutil (0.16.2) forwardable-extended (~> 2.6) public_suffix (4.0.6) - racc (1.5.2) + racc (1.6.0) rack (2.2.3) rack-protection (2.1.0) rack rack-rewrite (1.5.1) rack-ssl (1.4.1) rack - raindrops (0.19.1) - rake (13.0.3) - rb-fsevent (0.10.4) + raindrops (0.19.2) + rake (13.0.6) + rb-fsevent (0.11.0) rb-inotify (0.10.1) ffi (~> 1.0) rexml (3.2.5) - rouge (3.26.0) + rouge (3.26.1) safe_yaml (1.0.5) sassc (2.4.0) ffi (~> 1.9) - slop (4.8.2) + slop (4.9.1) spidr (0.6.1) nokogiri (~> 1.3) terminal-table (2.0.0) unicode-display_width (~> 1.1, >= 1.1.1) tidy_ffi (1.0.1) ffi (~> 1.2) - unicode-display_width (1.7.0) - unicorn (5.8.0) + unicode-display_width (1.8.0) + unicorn (6.0.0) kgio (~> 2.6) raindrops (~> 0.7) - validate-website (1.10.0) + validate-website (1.11.1) crass (~> 1) + nokogumbo (~> 2.0) paint (~> 2) slop (~> 4.6) spidr (~> 0.6) tidy_ffi (~> 1.0) w3c_validators (~> 1.3) + webrick (~> 1) w3c_validators (1.3.6) json (>= 1.8) nokogiri (~> 1.6) rexml (~> 3.2) + webrick (1.7.0) PLATFORMS ruby From 41d8abca5dfd1a2dbd578c47796740cd5cf7c24e Mon Sep 17 00:00:00 2001 From: vurtn Date: Tue, 26 Oct 2021 08:56:52 +0200 Subject: [PATCH 0033/1090] Translate from Jul to Aug 2021 (fr) --- .../_posts/2021-04-05-ruby-2-5-9-released.md | 2 +- .../_posts/2021-04-05-ruby-2-6-7-released.md | 4 +- .../_posts/2021-04-05-ruby-2-7-3-released.md | 2 +- .../_posts/2021-04-05-ruby-3-0-1-released.md | 2 +- ...ath-traversal-on-windows-cve-2021-28966.md | 4 +- ...p-vulnerability-in-rexml-cve-2021-28965.md | 4 +- ...2021-05-02-os-command-injection-in-rdoc.md | 2 +- .../_posts/2021-07-07-ruby-2-6-8-released.md | 59 +++++++++++++++++++ .../_posts/2021-07-07-ruby-2-7-4-released.md | 57 ++++++++++++++++++ .../_posts/2021-07-07-ruby-3-0-2-released.md | 48 +++++++++++++++ ...21-07-07-starttls-stripping-in-net-imap.md | 33 +++++++++++ ...7-07-trusting-pasv-responses-in-net-ftp.md | 33 +++++++++++ .../2021-08-03-fukuoka-ruby-award-2022.md | 32 ++++++++++ 13 files changed, 272 insertions(+), 10 deletions(-) create mode 100644 fr/news/_posts/2021-07-07-ruby-2-6-8-released.md create mode 100644 fr/news/_posts/2021-07-07-ruby-2-7-4-released.md create mode 100644 fr/news/_posts/2021-07-07-ruby-3-0-2-released.md create mode 100644 fr/news/_posts/2021-07-07-starttls-stripping-in-net-imap.md create mode 100644 fr/news/_posts/2021-07-07-trusting-pasv-responses-in-net-ftp.md create mode 100644 fr/news/_posts/2021-08-03-fukuoka-ruby-award-2022.md diff --git a/fr/news/_posts/2021-04-05-ruby-2-5-9-released.md b/fr/news/_posts/2021-04-05-ruby-2-5-9-released.md index 945c6db0ec..f560198b7e 100644 --- a/fr/news/_posts/2021-04-05-ruby-2-5-9-released.md +++ b/fr/news/_posts/2021-04-05-ruby-2-5-9-released.md @@ -2,7 +2,7 @@ layout: news_post title: "Ruby 2.5.9 est disponible" author: "usa" -translator: "Manaleak2d" +translator: "Kevin Rosaz" date: 2021-04-05 12:00:00 +0000 lang: fr --- diff --git a/fr/news/_posts/2021-04-05-ruby-2-6-7-released.md b/fr/news/_posts/2021-04-05-ruby-2-6-7-released.md index 6c5d6f6659..b14bbaffb3 100644 --- a/fr/news/_posts/2021-04-05-ruby-2-6-7-released.md +++ b/fr/news/_posts/2021-04-05-ruby-2-6-7-released.md @@ -2,7 +2,7 @@ layout: news_post title: "Ruby 2.6.7 est disponible" author: "usa" -translator: "Manaleak2d" +translator: "Kevin Rosaz" date: 2021-04-05 12:00:00 +0000 lang: fr --- @@ -20,7 +20,7 @@ Voir les [logs de commit](https://github.com/ruby/ruby/compare/v2_6_6...v2_6_7) A partir de cette version, nous terminons la phase de maintenance standard de la branche 2.6 et entrons dans la phase de maintenance de sécurité. Cela signifie qu'il n'y aura plus de _backports_ de correctifs pour Ruby 2.6 sauf pour ceux concernant la sécurité. Cette phase de maintenance réduite se terminera dans un an. La branche 2.6 de Ruby ne sera alors plus officiellement supportée. -Nous vous recommandons donc passer vers Ruby 2.7 ou 3.0. +Nous vous recommandons donc de passer vers Ruby 2.7 ou 3.0. ## Téléchargement diff --git a/fr/news/_posts/2021-04-05-ruby-2-7-3-released.md b/fr/news/_posts/2021-04-05-ruby-2-7-3-released.md index 7ff88a2073..f02e19a499 100644 --- a/fr/news/_posts/2021-04-05-ruby-2-7-3-released.md +++ b/fr/news/_posts/2021-04-05-ruby-2-7-3-released.md @@ -2,7 +2,7 @@ layout: news_post title: "Ruby 2.7.3 est disponible" author: "nagachika" -translator: "Manaleak2d" +translator: "Kevin Rosaz" date: 2021-04-05 12:00:00 +0000 lang: fr --- diff --git a/fr/news/_posts/2021-04-05-ruby-3-0-1-released.md b/fr/news/_posts/2021-04-05-ruby-3-0-1-released.md index f0121a2917..9865d8d46d 100644 --- a/fr/news/_posts/2021-04-05-ruby-3-0-1-released.md +++ b/fr/news/_posts/2021-04-05-ruby-3-0-1-released.md @@ -2,7 +2,7 @@ layout: news_post title: "Ruby 3.0.1 est disponible" author: "naruse" -translator: "Manaleak2d" +translator: "Kevin Rosaz" date: 2021-04-05 12:00:00 +0000 lang: fr --- diff --git a/fr/news/_posts/2021-04-05-tempfile-path-traversal-on-windows-cve-2021-28966.md b/fr/news/_posts/2021-04-05-tempfile-path-traversal-on-windows-cve-2021-28966.md index e65cecd177..70ede1cf1b 100644 --- a/fr/news/_posts/2021-04-05-tempfile-path-traversal-on-windows-cve-2021-28966.md +++ b/fr/news/_posts/2021-04-05-tempfile-path-traversal-on-windows-cve-2021-28966.md @@ -2,7 +2,7 @@ layout: news_post title: "CVE-2021-28966: Path traversal dans Tempfile sur Windows" author: "mame" -translator: "Manaleak2d" +translator: "Kevin Rosaz" date: 2021-04-05 12:00:00 +0000 tags: security lang: fr @@ -23,7 +23,7 @@ Tous les utilisateurs qui possède une version concernée devraient faire la mis - Ruby 2.7.2 ou inférieure - Ruby 3.0.0 -## Crédits +## Remerciements Merci à [Bugdiscloseguys](https://hackerone.com/bugdiscloseguys) pour la découverte de ce problème. diff --git a/fr/news/_posts/2021-04-05-xml-round-trip-vulnerability-in-rexml-cve-2021-28965.md b/fr/news/_posts/2021-04-05-xml-round-trip-vulnerability-in-rexml-cve-2021-28965.md index 2f29eeeffb..f1b84c3db5 100644 --- a/fr/news/_posts/2021-04-05-xml-round-trip-vulnerability-in-rexml-cve-2021-28965.md +++ b/fr/news/_posts/2021-04-05-xml-round-trip-vulnerability-in-rexml-cve-2021-28965.md @@ -2,7 +2,7 @@ layout: news_post title: "CVE-2021-28965: Vulnérabilité XML round-trip dans REXML" author: "mame" -translator: "Manaleak2d" +translator: "Kevin Rosaz" date: 2021-04-05 12:00:00 +0000 tags: security lang: fr @@ -35,7 +35,7 @@ Si vous utilisez Ruby 2.5.8 ou inférieure : - Ruby 3.0.1 ou inférieure - REXML gem 3.2.4 ou inférieure -## Crédits +## Remerciements Merci à [Juho Nurminen](https://hackerone.com/jupenur) pour la découverte de ce problème. diff --git a/fr/news/_posts/2021-05-02-os-command-injection-in-rdoc.md b/fr/news/_posts/2021-05-02-os-command-injection-in-rdoc.md index 68fde7fa64..7a0e46f25c 100644 --- a/fr/news/_posts/2021-05-02-os-command-injection-in-rdoc.md +++ b/fr/news/_posts/2021-05-02-os-command-injection-in-rdoc.md @@ -2,7 +2,7 @@ layout: news_post title: "CVE-2021-31799: Faille d'injection de commandes dans RDoc" author: "aycabta" -translator: "Manaleak2d" +translator: "Kevin Rosaz" date: 2021-05-02 09:00:00 +0000 tags: security lang: fr diff --git a/fr/news/_posts/2021-07-07-ruby-2-6-8-released.md b/fr/news/_posts/2021-07-07-ruby-2-6-8-released.md new file mode 100644 index 0000000000..08eefc0918 --- /dev/null +++ b/fr/news/_posts/2021-07-07-ruby-2-6-8-released.md @@ -0,0 +1,59 @@ +--- +layout: news_post +title: "Ruby 2.6.8 est disponible" +author: "usa" +translator: "Kevin Rosaz" +date: 2021-07-07 09:00:00 +0000 +lang: fr +--- +Ruby 2.6.8 est disponible. + +Cette version contient des correctifs concernant des problèmes de sécurité. +Merci de regarder les sujets suivants pour plus de détails. + +* [CVE-2021-31810: Une vulnérabilité concernant la confiance des réponses FTP PASV dans Net::FTP]({%link fr/news/_posts/2021-07-07-trusting-pasv-responses-in-net-ftp.md %}) +* [CVE-2021-32066: Une vulnérabilité StartTLS stripping dans Net::IMAP]({%link fr/news/_posts/2021-07-07-starttls-stripping-in-net-imap.md %}) +* [CVE-2021-31799: Faille d'injection de commandes dans RDoc]({%link fr/news/_posts/2021-05-02-os-command-injection-in-rdoc.md %}) + +En règle générale, nous ne mettons pas à jour Ruby 2.6 à l'exception des correctifs de sécurité. Néanmoins, cette version inclut également la résolution de bugs de régression et de build. +Voir les [logs de commit](https://github.com/ruby/ruby/compare/v2_6_7...v2_6_8) pour de plus amples informations. + +Ruby 2.6 est désormais dans la phase de maintenance de sécurité jusqu'à la fin mars 2022. +Après cette date, la maintenance de Ruby 2.6 sera terminée. +Nous vous recommandons donc de passer vers Ruby 2.7 ou 3.0. + +## Téléchargement + +{% assign release = site.data.releases | where: "version", "2.6.8" | first %} + +* <{{ release.url.bz2 }}> + + SIZE: {{ release.size.bz2 }} + SHA1: {{ release.sha1.bz2 }} + SHA256: {{ release.sha256.bz2 }} + SHA512: {{ release.sha512.bz2 }} + +* <{{ release.url.gz }}> + + SIZE: {{ release.size.gz }} + SHA1: {{ release.sha1.gz }} + SHA256: {{ release.sha256.gz }} + SHA512: {{ release.sha512.gz }} + +* <{{ release.url.xz }}> + + SIZE: {{ release.size.xz }} + SHA1: {{ release.sha1.xz }} + SHA256: {{ release.sha256.xz }} + SHA512: {{ release.sha512.xz }} + +* <{{ release.url.zip }}> + + SIZE: {{ release.size.zip }} + SHA1: {{ release.sha1.zip }} + SHA256: {{ release.sha256.zip }} + SHA512: {{ release.sha512.zip }} + +## Commentaire de version + +Merci aux contributeurs, développeurs et utilisateurs qui, en reportant les bugs, nous ont permis de faire cette version. \ No newline at end of file diff --git a/fr/news/_posts/2021-07-07-ruby-2-7-4-released.md b/fr/news/_posts/2021-07-07-ruby-2-7-4-released.md new file mode 100644 index 0000000000..8f425a43ca --- /dev/null +++ b/fr/news/_posts/2021-07-07-ruby-2-7-4-released.md @@ -0,0 +1,57 @@ +--- +layout: news_post +title: "Ruby 2.7.4 est disponible" +author: "usa" +translator: "Kevin Rosaz" +date: 2021-07-07 09:00:00 +0000 +lang: fr +--- + +Ruby 2.7.4 est disponible. + +Cette version contient des correctifs concernant des problèmes de sécurité. +Merci de regarder les sujets suivants pour plus de détails. + +* [CVE-2021-31810: Une vulnérabilité concernant la confiance des réponses FTP PASV dans Net::FTP]({%link fr/news/_posts/2021-07-07-trusting-pasv-responses-in-net-ftp.md %}) +* [CVE-2021-32066: Une vulnérabilité StartTLS stripping dans Net::IMAP]({%link fr/news/_posts/2021-07-07-starttls-stripping-in-net-imap.md %}) +* [CVE-2021-31799: Faille d'injection de commandes dans RDoc]({%link fr/news/_posts/2021-05-02-os-command-injection-in-rdoc.md %}) + +Voir les [logs de commit](https://github.com/ruby/ruby/compare/v2_7_3...v2_7_4) pour de plus amples informations. + +## Téléchargement + +{% assign release = site.data.releases | where: "version", "2.7.4" | first %} + +* <{{ release.url.bz2 }}> + + SIZE: {{ release.size.bz2 }} + SHA1: {{ release.sha1.bz2 }} + SHA256: {{ release.sha256.bz2 }} + SHA512: {{ release.sha512.bz2 }} + +* <{{ release.url.gz }}> + + SIZE: {{ release.size.gz }} + SHA1: {{ release.sha1.gz }} + SHA256: {{ release.sha256.gz }} + SHA512: {{ release.sha512.gz }} + +* <{{ release.url.xz }}> + + SIZE: {{ release.size.xz }} + SHA1: {{ release.sha1.xz }} + SHA256: {{ release.sha256.xz }} + SHA512: {{ release.sha512.xz }} + +* <{{ release.url.zip }}> + + SIZE: {{ release.size.zip }} + SHA1: {{ release.sha1.zip }} + SHA256: {{ release.sha256.zip }} + SHA512: {{ release.sha512.zip }} + +## Commentaire de version + +Merci aux contributeurs, développeurs et utilisateurs qui, en reportant les bugs, nous ont permis de faire cette version. + +Le support de la branche 2.7 est documenté et encadré par le document *Agreement for the Ruby stable version* publié par la Ruby Association. \ No newline at end of file diff --git a/fr/news/_posts/2021-07-07-ruby-3-0-2-released.md b/fr/news/_posts/2021-07-07-ruby-3-0-2-released.md new file mode 100644 index 0000000000..5b4c46fa5e --- /dev/null +++ b/fr/news/_posts/2021-07-07-ruby-3-0-2-released.md @@ -0,0 +1,48 @@ +--- +layout: news_post +title: "Ruby 3.0.2 est disponible" +author: "nagachika" +translator: "Kevin Rosaz" +date: 2021-07-07 09:00:00 +0000 +lang: fr +--- + +Ruby 3.0.2 est disponible. + +Cette version contient des correctifs concernant des problèmes de sécurité. +Merci de regarder les sujets suivants pour plus de détails. + +* [CVE-2021-31810: Une vulnérabilité concernant la confiance des réponses FTP PASV dans Net::FTP]({%link fr/news/_posts/2021-07-07-trusting-pasv-responses-in-net-ftp.md %}) +* [CVE-2021-32066: Une vulnérabilité StartTLS stripping dans Net::IMAP]({%link fr/news/_posts/2021-07-07-starttls-stripping-in-net-imap.md %}) +* [CVE-2021-31799: Faille d'injection de commandes dans RDoc]({%link fr/news/_posts/2021-05-02-os-command-injection-in-rdoc.md %}) + +Voir les [logs de commit](https://github.com/ruby/ruby/compare/v3_0_1...v3_0_2) pour de plus amples informations. + +## Téléchargement + +{% assign release = site.data.releases | where: "version", "3.0.2" | first %} + +* <{{ release.url.gz }}> + + SIZE: {{ release.size.gz }} + SHA1: {{ release.sha1.gz }} + SHA256: {{ release.sha256.gz }} + SHA512: {{ release.sha512.gz }} + +* <{{ release.url.xz }}> + + SIZE: {{ release.size.xz }} + SHA1: {{ release.sha1.xz }} + SHA256: {{ release.sha256.xz }} + SHA512: {{ release.sha512.xz }} + +* <{{ release.url.zip }}> + + SIZE: {{ release.size.zip }} + SHA1: {{ release.sha1.zip }} + SHA256: {{ release.sha256.zip }} + SHA512: {{ release.sha512.zip }} + +## Commentaire de version + +Merci aux contributeurs, développeurs et utilisateurs qui, en reportant les bugs, nous ont permis de faire cette version. \ No newline at end of file diff --git a/fr/news/_posts/2021-07-07-starttls-stripping-in-net-imap.md b/fr/news/_posts/2021-07-07-starttls-stripping-in-net-imap.md new file mode 100644 index 0000000000..09bbe43b9f --- /dev/null +++ b/fr/news/_posts/2021-07-07-starttls-stripping-in-net-imap.md @@ -0,0 +1,33 @@ +--- +layout: news_post +title: "CVE-2021-32066: Une vulnérabilité StartTLS stripping dans Net::IMAP" +author: "shugo" +translator: "Kevin Rosaz" +date: 2021-07-07 09:00:00 +0000 +tags: security +lang: fr +--- + +Une vulnérabilité StartTLS stripping a été découverte dans Net::IMAP. +Cette vulnérabilité possède l'identifiant CVE [CVE-2021-32066](https://nvd.nist.gov/vuln/detail/CVE-2021-32066). +Nous vous recommandons fortement de mettre à jour Ruby. + +net-imap est une gemme incluse par défaut dans Ruby 3.0.1, mais a un problème d'empaquetage. Veuillez donc mettre à jour Ruby lui-même. + +## Détails + +Net::IMAP ne lève pas d'exception lorsque StartTLS échoue avec une réponse inconnue. Cela pourrait permettre à des attaques de type man-in-the-middle de contourner les protections de TLS en se positionnant entre le client et le registre pour bloquer la commande StartTLS, alias une attaque par "StartTLS stripping". + +## Versions concernées + +* Toutes les versions de Ruby 2.6 antérieures à Ruby 2.6.7 +* Toutes les versions de Ruby 2.7 antérieures à Ruby 2.7.3 +* Toutes les versions de Ruby 3.0 antérieures à Ruby 3.0.1 + +## Remerciements + +Merci à [Alexandr Savca](https://hackerone.com/chinarulezzz) pour la découverte de ce problème. + +## Historique + +* Paru initialement le 2021-07-07 09:00:00 UTC diff --git a/fr/news/_posts/2021-07-07-trusting-pasv-responses-in-net-ftp.md b/fr/news/_posts/2021-07-07-trusting-pasv-responses-in-net-ftp.md new file mode 100644 index 0000000000..fa2af0a512 --- /dev/null +++ b/fr/news/_posts/2021-07-07-trusting-pasv-responses-in-net-ftp.md @@ -0,0 +1,33 @@ +--- +layout: news_post +title: "CVE-2021-31810: Une vulnérabilité concernant la confiance des réponses FTP PASV dans Net::FTP" +author: "shugo" +translator: "Kevin Rosaz" +date: 2021-07-07 09:00:00 +0000 +tags: security +lang: fr +--- + +Une vulnérabilité concernant la confiance des réponses FTP PASV a été découverte dans Net::FTP. +Cette vulnérabilité possède l'identifiant CVE [CVE-2021-31810](https://nvd.nist.gov/vuln/detail/CVE-2021-31810). +Nous vous recommandons fortement de mettre à jour Ruby. + +net-ftp est une gemme incluse par défaut dans Ruby 3.0.1, mais a un problème d'empaquetage. Veuillez donc mettre à jour Ruby lui-même. + +## Détails + +Un serveur FTP malveillant peut utiliser la réponse PASV pour tromper Net::FTP afin qu'il se reconnecte à une adresse IP et port donnés. Cela permet potentiellement à Net::FTP de récupérer des informations sur des services qui sont par ailleurs privés et non divulgués (par exemple, l'attaquant peut effectuer des analyses de ports et récupérer les bannières de services). + +## Versions concernées + +* Toutes les versions de Ruby 2.6 antérieures à Ruby 2.6.7 +* Toutes les versions de Ruby 2.7 antérieures à Ruby 2.7.3 +* Toutes les versions de Ruby 3.0 antérieures à Ruby 3.0.1 + +## Remerciements + +Merci à [Alexandr Savca](https://hackerone.com/chinarulezzz) pour la découverte de ce problème. + +## Historique + +* Paru initialement le 2021-07-07 09:00:00 UTC diff --git a/fr/news/_posts/2021-08-03-fukuoka-ruby-award-2022.md b/fr/news/_posts/2021-08-03-fukuoka-ruby-award-2022.md new file mode 100644 index 0000000000..0fa8054067 --- /dev/null +++ b/fr/news/_posts/2021-08-03-fukuoka-ruby-award-2022.md @@ -0,0 +1,32 @@ +--- +layout: news_post +title: "Concours 2022 Fukuoka Ruby Award - Les candidatures seront jugées par Matz" +author: "Fukuoka Ruby" +translator: "Kevin Rosaz" +date: 2021-08-03 00:00:00 +0000 +lang: fr +--- + +Chers passionnés de Ruby, + +Le gouvernement de Fukuoka au Japon et « Matz » Matsumoto aimeraient vous inviter à participer au concours Ruby suivant. Si vous avez développé un programme Ruby intéressant, vous êtes encouragés à postuler. + +Concours 2022 Fukuoka Ruby Award - Grand Prix - 1 Million de Yens! + +Date limite d'inscription : 3 décembre 2021 + +![Fukuoka Ruby Award](https://www.digitalfukuoka.jp/javascripts/kcfinder/upload/images/fukuokarubyaward2017.png) + +Matz et un groupe de panélistes sélectionneront les gagnants du concours de Fukuoka. Le grand prix du concours de Fukuoka est de 1 million de yens. Les anciens gagnants du grand prix sont Rhomobile (États-Unis) et APEC Climate Center (Corée). + +Les programmes inscrits au concours n'ont pas à être entièrement écrits en Ruby, mais doivent tirer parti des caractéristiques uniques de Ruby. + +Le programme doit avoir été développé ou mis à jour au cours de l'année passée. Veuillez visiter le site Web de Fukuoka suivant pour participer. + +[http://www.digitalfukuoka.jp/events/242](http://www.digitalfukuoka.jp/events/242) + +Veuillez envoyer le formulaire de candidature à award@f-ruby.com + +« Matz testera et révisera votre code source de manière approfondie, il est donc très intéressant de postuler ! Le concours est gratuit. » + +Merci! \ No newline at end of file From 45b03a82f61eb00c95ad1fe30395957d96605e7e Mon Sep 17 00:00:00 2001 From: vurtn Date: Tue, 26 Oct 2021 09:17:50 +0200 Subject: [PATCH 0034/1090] remove trailing whitespace and add newline at end of files --- fr/news/_posts/2021-07-07-ruby-2-6-8-released.md | 2 +- fr/news/_posts/2021-07-07-ruby-2-7-4-released.md | 2 +- fr/news/_posts/2021-07-07-ruby-3-0-2-released.md | 2 +- fr/news/_posts/2021-07-07-starttls-stripping-in-net-imap.md | 6 +++--- .../_posts/2021-07-07-trusting-pasv-responses-in-net-ftp.md | 6 +++--- fr/news/_posts/2021-08-03-fukuoka-ruby-award-2022.md | 4 ++-- 6 files changed, 11 insertions(+), 11 deletions(-) diff --git a/fr/news/_posts/2021-07-07-ruby-2-6-8-released.md b/fr/news/_posts/2021-07-07-ruby-2-6-8-released.md index 08eefc0918..d798a9db12 100644 --- a/fr/news/_posts/2021-07-07-ruby-2-6-8-released.md +++ b/fr/news/_posts/2021-07-07-ruby-2-6-8-released.md @@ -56,4 +56,4 @@ Nous vous recommandons donc de passer vers Ruby 2.7 ou 3.0. ## Commentaire de version -Merci aux contributeurs, développeurs et utilisateurs qui, en reportant les bugs, nous ont permis de faire cette version. \ No newline at end of file +Merci aux contributeurs, développeurs et utilisateurs qui, en reportant les bugs, nous ont permis de faire cette version. diff --git a/fr/news/_posts/2021-07-07-ruby-2-7-4-released.md b/fr/news/_posts/2021-07-07-ruby-2-7-4-released.md index 8f425a43ca..2f06161b78 100644 --- a/fr/news/_posts/2021-07-07-ruby-2-7-4-released.md +++ b/fr/news/_posts/2021-07-07-ruby-2-7-4-released.md @@ -54,4 +54,4 @@ Voir les [logs de commit](https://github.com/ruby/ruby/compare/v2_7_3...v2_7_4) Merci aux contributeurs, développeurs et utilisateurs qui, en reportant les bugs, nous ont permis de faire cette version. -Le support de la branche 2.7 est documenté et encadré par le document *Agreement for the Ruby stable version* publié par la Ruby Association. \ No newline at end of file +Le support de la branche 2.7 est documenté et encadré par le document *Agreement for the Ruby stable version* publié par la Ruby Association. diff --git a/fr/news/_posts/2021-07-07-ruby-3-0-2-released.md b/fr/news/_posts/2021-07-07-ruby-3-0-2-released.md index 5b4c46fa5e..b6753fc1d4 100644 --- a/fr/news/_posts/2021-07-07-ruby-3-0-2-released.md +++ b/fr/news/_posts/2021-07-07-ruby-3-0-2-released.md @@ -45,4 +45,4 @@ Voir les [logs de commit](https://github.com/ruby/ruby/compare/v3_0_1...v3_0_2) ## Commentaire de version -Merci aux contributeurs, développeurs et utilisateurs qui, en reportant les bugs, nous ont permis de faire cette version. \ No newline at end of file +Merci aux contributeurs, développeurs et utilisateurs qui, en reportant les bugs, nous ont permis de faire cette version. diff --git a/fr/news/_posts/2021-07-07-starttls-stripping-in-net-imap.md b/fr/news/_posts/2021-07-07-starttls-stripping-in-net-imap.md index 09bbe43b9f..8574b3db89 100644 --- a/fr/news/_posts/2021-07-07-starttls-stripping-in-net-imap.md +++ b/fr/news/_posts/2021-07-07-starttls-stripping-in-net-imap.md @@ -20,9 +20,9 @@ Net::IMAP ne lève pas d'exception lorsque StartTLS échoue avec une réponse in ## Versions concernées -* Toutes les versions de Ruby 2.6 antérieures à Ruby 2.6.7 -* Toutes les versions de Ruby 2.7 antérieures à Ruby 2.7.3 -* Toutes les versions de Ruby 3.0 antérieures à Ruby 3.0.1 +* Toutes les versions de Ruby 2.6 antérieures à Ruby 2.6.7 +* Toutes les versions de Ruby 2.7 antérieures à Ruby 2.7.3 +* Toutes les versions de Ruby 3.0 antérieures à Ruby 3.0.1 ## Remerciements diff --git a/fr/news/_posts/2021-07-07-trusting-pasv-responses-in-net-ftp.md b/fr/news/_posts/2021-07-07-trusting-pasv-responses-in-net-ftp.md index fa2af0a512..4e3d446bf8 100644 --- a/fr/news/_posts/2021-07-07-trusting-pasv-responses-in-net-ftp.md +++ b/fr/news/_posts/2021-07-07-trusting-pasv-responses-in-net-ftp.md @@ -20,9 +20,9 @@ Un serveur FTP malveillant peut utiliser la réponse PASV pour tromper Net::FTP ## Versions concernées -* Toutes les versions de Ruby 2.6 antérieures à Ruby 2.6.7 -* Toutes les versions de Ruby 2.7 antérieures à Ruby 2.7.3 -* Toutes les versions de Ruby 3.0 antérieures à Ruby 3.0.1 +* Toutes les versions de Ruby 2.6 antérieures à Ruby 2.6.7 +* Toutes les versions de Ruby 2.7 antérieures à Ruby 2.7.3 +* Toutes les versions de Ruby 3.0 antérieures à Ruby 3.0.1 ## Remerciements diff --git a/fr/news/_posts/2021-08-03-fukuoka-ruby-award-2022.md b/fr/news/_posts/2021-08-03-fukuoka-ruby-award-2022.md index 0fa8054067..5cfd9c11f3 100644 --- a/fr/news/_posts/2021-08-03-fukuoka-ruby-award-2022.md +++ b/fr/news/_posts/2021-08-03-fukuoka-ruby-award-2022.md @@ -11,7 +11,7 @@ Chers passionnés de Ruby, Le gouvernement de Fukuoka au Japon et « Matz » Matsumoto aimeraient vous inviter à participer au concours Ruby suivant. Si vous avez développé un programme Ruby intéressant, vous êtes encouragés à postuler. -Concours 2022 Fukuoka Ruby Award - Grand Prix - 1 Million de Yens! +Concours 2022 Fukuoka Ruby Award - Grand Prix - 1 Million de Yens ! Date limite d'inscription : 3 décembre 2021 @@ -29,4 +29,4 @@ Veuillez envoyer le formulaire de candidature à award@f-ruby.com « Matz testera et révisera votre code source de manière approfondie, il est donc très intéressant de postuler ! Le concours est gratuit. » -Merci! \ No newline at end of file +Merci ! From c25ca4f4adfb76a746583ba1f10c124e13c6981d Mon Sep 17 00:00:00 2001 From: Alejandra Cernas Date: Wed, 27 Oct 2021 04:34:59 -0500 Subject: [PATCH 0035/1090] add es/community/ruby-core (#2708) * add es/community/ruby-core * Remove blank line at the end of the file * Attend pr comments --- es/community/ruby-core/index.md | 136 ++++++++++++++++++ .../ruby-core/writing-patches/index.md | 47 ++++++ 2 files changed, 183 insertions(+) create mode 100644 es/community/ruby-core/index.md create mode 100644 es/community/ruby-core/writing-patches/index.md diff --git a/es/community/ruby-core/index.md b/es/community/ruby-core/index.md new file mode 100644 index 0000000000..bde8701826 --- /dev/null +++ b/es/community/ruby-core/index.md @@ -0,0 +1,136 @@ +--- +layout: page +title: "Ruby Core" +lang: es +--- + +Ahora es un momento fantástico para seguir el desarrollo de Ruby. +Con la mayor atención que Ruby ha recibido en los últimos años, +existe una creciente necesidad de buenos talentos para ayudar a mejorar Ruby +y documentar sus partes. Entonces, ¿por dónde empezar? +{: .summary} + +Los temas relacionados con el desarrollo de Ruby que se tratan aquí son: + +* [Usando Git para rastrear el desarrollo de Ruby](#following-ruby) +* [Mejorando Ruby, Parche por Parche](#patching-ruby) +* [Nota sobre las ramas](#branches-ruby) + +### Usando Git para rastrear el desarrollo de Ruby +{: #following-ruby} + +El repositorio principal actual del último código fuente de Ruby es +[git.ruby-lang.org/ruby.git][gitrlo]. +También existe un repositorio [espejo en GitHub][7]. En lo general, usa el +repositorio espejo, por favor. + +Puedes obtener el último código fuente de Ruby usando Git. +Desde tu línea de comandos: + +{% highlight sh %} +$ git clone https://github.com/ruby/ruby.git +{% endhighlight %} + +El directorio `ruby` ahora contendrá el último código fuente +para la versión de desarrollo de Ruby (ruby-trunk). + +Vease también [Cómo unirse a nuestro desarrollo como no contribuyente de código fuente][noncommitterhowto]. + +Si tienes permisos de contribución al código fuente y deseas empujar cambios, +deberías usar el repositorio principal. + +{% highlight sh %} +$ git clone git@git.ruby-lang.org:ruby.git +{% endhighlight %} + +### Mejorando Ruby, Parche por Parche +{: #patching-ruby} + +El equipo central mantiene un [rastreador de problemas][10] para enviar parches e +informes de errores a Matz y al grupo. Estos informes también se envían a +la [lista de distribución de Ruby-Core][mailing-lists] para discusión, +así que puedes estar seguro que tu petición no pasará desapercibida. +También puedes enviar tus parches directamente a la lista de +distribución. De cualquier manera, te invitamos a formar parte de las +discusiones siguientes. + +Consulta la [Guía del redactor de Parches][writing-patches] para obtener algunos consejos, +directamente de Matz, sobre cómo hacer que tus parches sean considerados. + +En resumen, los pasos para crear un parche son: + +1. Consulta una copia del código fuente de Ruby de GitHub. + Por lo general, los parches para la corrección de errores + o las nuevas funciones deben enviarse al tronco de la fuente de Ruby. + + $ git clone https://github.com/ruby/ruby.git + + Si estás solucionando un error que es específico de una sola rama de mantenimiento, + revisa una copia de la rama respectiva. + + $ git checkout ruby_X_X + + X_X debe ser reemplazado por la versión que desees revisar. + +2. Agrega tus mejoras al código. + +3. Crea un parche. + + $ git diff > ruby-changes.patch + +4. Crea un ticket en el [rastreador de problemas][10] o envía tu parche + a la [lista de distribución de Ruby-Core][mailing-lists] con un registro de ChangeLog + describiendo tu parche. + +5. Si no surgen problemas sobre el parche, los contribuyentes darán + la aprobación para aplicarlo. + +**Por favor ten en cuenta:** los parches deben enviarse como una [diferencia unificada][12]. +Para obtener más información sobre cómo se fusionan los parches, consulta [la referencia de diffutils][13]. + +La discusión sobre el desarrollo de Ruby converge en la +[Lista de distribución de Ruby-Core][mailing-lists]. Entonces, si tienes curiosidad +sobre si tu parche vale la pena o si deseas iniciar una discusión +sobre el futuro de Ruby, no dudes en subir a bordo. +Ten presente que las discusiones fuera de tema no se toleran en esta lista, +el nivel de ruido debe ser muy bajo, los temas deben ser puntuales, bien concebidos y +bien escritos. Ya que nos dirigimos al creador de Ruby, tengamos un poco de reverencia. + +Ten en cuenta que muchos de los desarrolladores principales de Ruby viven en Japón y, aunque muchos +hablan muy bien inglés, hay una diferencia de zona horaria significativa. +También tienen un cuerpo completo de listas de desarrollo japonesas sucediendo +junto a las contrapartes inglesas. Se paciente, +si tu petición no se resuelve, se persistente, inténtalo de nuevo unos días más tarde. + + +### Nota sobre las ramas +{: #branches-ruby} + +El código fuente de Ruby se había gestionado en el repositorio de Subversion hasta el 22 de abril de 2019. +Por lo tanto, algunas ramas aún pueden administrarse bajo Subversion. +Puedes ver el repositorio de SVN. + +* [<URL:https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?root=ruby>][svn-viewvc] + +Sin embargo, no tienes que preocuparte por eso (a menos que seas un mantenedor de rama). +Puedes consultar las ramas en tu copia de trabajo de Git. +Por ejemplo, ejecuta el siguiente comando. + +{% highlight sh %} +$ git checkout ruby_X_X +{% endhighlight %} + +X_X debe ser reemplazado por la versión que desees revisar. + +Si deseas modificar las ramas, por favor, abre una incidencia en nuestro [rastreador de problemas][10]. +Ver también la siguiente sección. + +[gitrlo]: https://git.ruby-lang.org/ruby.git +[mailing-lists]: /es/community/mailing-lists/ +[writing-patches]: /es/community/ruby-core/writing-patches/ +[noncommitterhowto]: https://github.com/shyouhei/ruby/wiki/noncommitterhowto +[svn-viewvc]: https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?root=ruby +[7]: https://github.com/ruby/ruby +[10]: https://bugs.ruby-lang.org/ +[12]: http://www.gnu.org/software/diffutils/manual/html_node/Unified-Format.html +[13]: http://www.gnu.org/software/diffutils/manual/html_node/Merging-with-patch.html#Merging%20with%20patch diff --git a/es/community/ruby-core/writing-patches/index.md b/es/community/ruby-core/writing-patches/index.md new file mode 100644 index 0000000000..4652a7aa21 --- /dev/null +++ b/es/community/ruby-core/writing-patches/index.md @@ -0,0 +1,47 @@ +--- +layout: page +title: "Guía del redactor de Parches" +lang: es +--- +Sigue algunos consejos, directamente de Matz, sobre cómo hacer para que tus parches sean considerados. +{: .summary} + +Estas pautas fueron adoptadas de una [publicación hecha por Matz][ruby-core-post] +en la lista de distribución de Ruby-Core: + +* Implementa una modificación por parche + + Este es el mayor problema para la mayoría de los parches diferidos. Cuando tú + envias un parche que corrija varios errores (y agregue funciones) a la vez, + tenemos que separarlos antes de aplicarlos. Es una tarea bastante difícil para nosotros, + desarrolladores ocupados, por lo que este tipo de parches tiende a aplazarse. + Por favor, no envies parches grandes. + +* Agrega descripciones + + A veces, un simple parche no describe suficientemente el problema que soluciona. + Una mejor descripción (el problema que soluciona, las condiciones previas, la plataforma, etc.) + ayudaría a un parche a aplicarse más rápido. + +* Haz diff a la última revisión + + Es posible que tu problema se haya solucionado en la última revisión. O el código + podría ser totalmente diferente a estas alturas. Antes de enviar un parche, intenta recuperar + la última versión (la rama `trunk` para la última versión de desarrollo, + `{{ site.svn.stable.branch }}` para {{ site.svn.stable.version }}) + desde el repositorio de Subversion, por favor. + +* Usa `diff -u` + + Preferimos los parches de diferencias unificados de estilo `diff -u` a diferencia de `diff -c` + o cualquier otro estilo de parches. Son mucho más fáciles de revisar. + No envíes archivos modificados, no queremos hacer un diff por nosotros mismos. + +* Proporciona casos de prueba (opcional) + + Un parche que proporciona casos de prueba (preferiblemente un parche para `test/*/test_*.rb`) + nos ayudaría a comprender el parche y su intención. + +Podríamos pasar a un flujo de trabajo push/pull estilo Git en el futuro.. +Pero hasta entonces, seguir las pautas anteriores te ayudaría a evitar +una frustración. From 88c759625a890c2faf7b3eb51e579cb7f171788e Mon Sep 17 00:00:00 2001 From: Hiroshi SHIBATA Date: Thu, 28 Oct 2021 21:23:40 +0900 Subject: [PATCH 0036/1090] Use Ruby 3.0 --- .github/workflows/ci.yml | 2 +- Gemfile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a4f59de335..50e5b601d6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -8,7 +8,7 @@ jobs: strategy: matrix: - ruby: [2.7] + ruby: ["3.0"] os: [ubuntu-latest] fail-fast: false diff --git a/Gemfile b/Gemfile index 945407efd2..c274052fc9 100644 --- a/Gemfile +++ b/Gemfile @@ -1,6 +1,6 @@ source "https://rubygems.org" -ruby "~> 2.7.4" +ruby "~> 3.0.2" gem "rake" gem "jekyll", "~> 4.0" From 0d2c01b1baad1b2912627257a84160ff023dbabe Mon Sep 17 00:00:00 2001 From: Hiroshi SHIBATA Date: Thu, 28 Oct 2021 21:28:38 +0900 Subject: [PATCH 0037/1090] Update lockfile --- Gemfile.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index cd9f3c69bd..ebfc7e5301 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -119,7 +119,7 @@ DEPENDENCIES validate-website (~> 1.6) RUBY VERSION - ruby 2.7.4p191 + ruby 3.0.2p107 BUNDLED WITH - 2.1.4 + 2.2.27 From fc6a499822d3996e2ee4cdca8951c588bf6b752a Mon Sep 17 00:00:00 2001 From: Marcus Stollsteimer Date: Sun, 3 Jan 2021 20:39:12 +0100 Subject: [PATCH 0038/1090] Add helper methods file_must_exist, file_wont_exist --- test/helper.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/test/helper.rb b/test/helper.rb index 1b0c531a72..21c2278f9e 100644 --- a/test/helper.rb +++ b/test/helper.rb @@ -37,3 +37,13 @@ def linter_output stdout end + +def file_must_exist(filename) + assert File.exist?(filename), + "Expected file `#{filename}' to exist." +end + +def file_wont_exist(filename) + assert !File.exist?(filename), + "Expected file `#{filename}' to not exist." +end From 40e9c365cf333dd684fd2b0f890eb931d96da2b1 Mon Sep 17 00:00:00 2001 From: Marcus Stollsteimer Date: Sun, 3 Jan 2021 20:52:59 +0100 Subject: [PATCH 0039/1090] Add tests for news archives plugin Provide tests that check the used layouts for news archive pages. This targets issues like e.g. the one related to behavior changed with Jekyll 4.2.0, fixed in f29a3d5f33cbf7fc80a261fcc183682e3485dd1e. --- test/test_plugin_news.rb | 124 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 124 insertions(+) create mode 100644 test/test_plugin_news.rb diff --git a/test/test_plugin_news.rb b/test/test_plugin_news.rb new file mode 100644 index 0000000000..bd961d5780 --- /dev/null +++ b/test/test_plugin_news.rb @@ -0,0 +1,124 @@ +# frozen_string_literal: true + +require "helper" + +require "jekyll" +require_relative "../_plugins/news" + + +describe NewsArchivePlugin do + + before do + chdir_tempdir + + content = <<~CONFIG + CONFIG + + create_file("source/_config.yml", content) + + content = <<~LOCALES + month_names: + - January + - February + + news: + recent_news: Recent News + yearly_archive_title: "%Y Archives" + monthly_archive_title: "%B %Y Archives" + yearly_archive_link: "%Y Archives" + monthly_archive_link: "%B %Y" + LOCALES + + create_file("source/_data/locales/en.yml", content) + + content = <<~LAYOUT + --- + layout: default + --- + NEWS LAYOUT + + {% for post in page.posts %} + {{ post.title }} + {% endfor %} + LAYOUT + + create_file("source/_layouts/news.html", content) + + content = <<~LAYOUT + --- + layout: default + --- + NEWS ARCHIVE YEAR LAYOUT + + {% for post in page.posts %} + {{ post.title }} + {% endfor %} + LAYOUT + + create_file("source/_layouts/news_archive_year.html", content) + + content = <<~LAYOUT + --- + layout: default + --- + NEWS ARCHIVE MONTH LAYOUT + + {% for post in page.posts %} + {{ post.title }} + {% endfor %} + LAYOUT + + create_file("source/_layouts/news_archive_month.html", content) + + content = <<~POST + --- + title: "Post Jan 2020" + author: "stomar" + date: 2020-01-01 12:00:00 +0000 + lang: en + --- + + Content + POST + + create_file("source/en/news/_posts/2020-01-01-post.md", content) + + config = Jekyll.configuration( + source: "source", + destination: "_site", + quiet: true + ) + site = Jekyll::Site.new(config) + + file_wont_exist("_site") + site.process + end + + after do + teardown_tempdir + end + + it "should create news page" do + file_must_exist("_site/en/news/index.html") + end + + it "should use the correct layout for news page" do + _(File.read("_site/en/news/index.html")).must_match "NEWS LAYOUT" + end + + it "should create news/2020 page" do + file_must_exist("_site/en/news/2020/index.html") + end + + it "should use the correct layout for news/2020 page" do + _(File.read("_site/en/news/2020/index.html")).must_match "YEAR LAYOUT" + end + + it "should create news/2020/01 page" do + file_must_exist("_site/en/news/2020/index.html") + end + + it "should use the correct layout for news/2020/01 page" do + _(File.read("_site/en/news/2020/01/index.html")).must_match "MONTH LAYOUT" + end +end From e6821f14bf40cee8c99ebc086080d51fd1026f89 Mon Sep 17 00:00:00 2001 From: Marcus Stollsteimer Date: Mon, 4 Jan 2021 21:15:39 +0100 Subject: [PATCH 0040/1090] Add test task for news archives plugin --- Rakefile | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Rakefile b/Rakefile index 3547782f1b..420c1180e6 100644 --- a/Rakefile +++ b/Rakefile @@ -136,3 +136,11 @@ Rake::TestTask.new(:"test-linter") do |t| t.test_files = FileList['test/test_linter_*.rb'] t.verbose = true end + +require "rake/testtask" +Rake::TestTask.new(:"test-news-plugin") do |t| + t.description = "Run tests for the news archive plugin" + t.libs = ["test"] + t.test_files = FileList['test/test_plugin_news.rb'] + t.verbose = true +end From 1e3c9213ed01ffbcc4a2ddb06081137123f27d73 Mon Sep 17 00:00:00 2001 From: Marcus Stollsteimer Date: Sun, 21 Feb 2021 17:57:48 +0100 Subject: [PATCH 0041/1090] Always run tests for news archives plugin on CI --- Rakefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Rakefile b/Rakefile index 420c1180e6..e2d9b20cb3 100644 --- a/Rakefile +++ b/Rakefile @@ -14,7 +14,7 @@ CONFIG = "_config.yml" task default: [:build] desc "Run tests (test-linter, lint, build)" -task test: %i[test-linter lint build] +task test: %i[test-news-plugin test-linter lint build] desc "Build the Jekyll site" task :build do From eea7718405c15c22c9076f408c19e7330a8ad2ee Mon Sep 17 00:00:00 2001 From: Marcus Stollsteimer Date: Fri, 19 Feb 2021 17:25:09 +0100 Subject: [PATCH 0042/1090] Reformat JavaScript files Reformat JavaScript files to match code generated by TypeScript, in preparation for the introduction of TypeScript files. --- javascripts/examples.js | 22 +++++++++------------- javascripts/page.js | 33 +++++++++++++++------------------ 2 files changed, 24 insertions(+), 31 deletions(-) diff --git a/javascripts/examples.js b/javascripts/examples.js index ac3fa25164..e810630024 100644 --- a/javascripts/examples.js +++ b/javascripts/examples.js @@ -1,16 +1,12 @@ var Examples = { - names: ['cities', 'greeter', 'i_love_ruby', 'hello_world'], - - random: function() { - return Examples.names[Math.floor(Math.random() * Examples.names.length)]; - }, - - choose: function() { - var lang = document.location.pathname.split('/')[1]; - var name = Examples.random(); - - $("#code").load('/' + lang + '/examples/' + name + '/'); - } + names: ['cities', 'greeter', 'i_love_ruby', 'hello_world'], + random: function () { + return Examples.names[Math.floor(Math.random() * Examples.names.length)]; + }, + choose: function () { + var lang = document.location.pathname.split('/')[1]; + var name = Examples.random(); + $("#code").load('/' + lang + '/examples/' + name + '/'); + } }; - $(document).ready(Examples.choose); diff --git a/javascripts/page.js b/javascripts/page.js index e33f591ea9..f807e2bf30 100644 --- a/javascripts/page.js +++ b/javascripts/page.js @@ -1,24 +1,21 @@ var Page = { - SiteLinks: { - highlight: function() { - var current_page = location.pathname; - $("#header div.site-links a:not(.home)").each(function(i) { - if (current_page.indexOf($(this).attr('href')) == 0) { - $(this).addClass('selected'); + SiteLinks: { + highlight: function () { + var current_page = location.pathname; + $("#header div.site-links a:not(.home)").each(function (i) { + if (current_page.indexOf($(this).attr('href')) == 0) { + $(this).addClass('selected'); + } + }); + $("#home-page-layout #header div.site-links a.home").addClass('selected'); + }, + menu: function () { + $("#header div.site-links a.menu").on('click touchstart', function (event) { + $(this).closest("div.site-links").toggleClass("open"); + event.preventDefault(); + }); } - }); - - $("#home-page-layout #header div.site-links a.home").addClass('selected'); - }, - - menu: function() { - $("#header div.site-links a.menu").on('click touchstart', function(event) { - $(this).closest("div.site-links").toggleClass("open"); - event.preventDefault(); - }); } - } }; - $(Page.SiteLinks.highlight); $(Page.SiteLinks.menu); From fe098480aa65fdddff92142018207abfd1023627 Mon Sep 17 00:00:00 2001 From: Marcus Stollsteimer Date: Fri, 19 Feb 2021 17:34:15 +0100 Subject: [PATCH 0043/1090] Introduce TypeScript Set up TypeScript (add source directory and config file). The JavaScript files in `javascripts` can now be generated by running `tsc` in the root directory. This might be useful for future changes of the JavaScript. It does not affect the normal build process of the site. --- _config.yml | 1 + _javascripts_src/examples.ts | 16 ++++++++++++++++ _javascripts_src/page.ts | 24 ++++++++++++++++++++++++ tsconfig.json | 9 +++++++++ 4 files changed, 50 insertions(+) create mode 100644 _javascripts_src/examples.ts create mode 100644 _javascripts_src/page.ts create mode 100644 tsconfig.json diff --git a/_config.yml b/_config.yml index ec6719c04e..b1d9d3978f 100644 --- a/_config.yml +++ b/_config.yml @@ -18,6 +18,7 @@ exclude: - lib - test - vendor + - tsconfig.json url: https://www.ruby-lang.org diff --git a/_javascripts_src/examples.ts b/_javascripts_src/examples.ts new file mode 100644 index 0000000000..bc3054af98 --- /dev/null +++ b/_javascripts_src/examples.ts @@ -0,0 +1,16 @@ +var Examples = { + names: ['cities', 'greeter', 'i_love_ruby', 'hello_world'], + + random: function () { + return Examples.names[Math.floor(Math.random() * Examples.names.length)]; + }, + + choose: function () { + var lang = document.location.pathname.split('/')[1]; + var name = Examples.random(); + + $("#code").load('/' + lang + '/examples/' + name + '/'); + } +}; + +$(document).ready(Examples.choose); diff --git a/_javascripts_src/page.ts b/_javascripts_src/page.ts new file mode 100644 index 0000000000..8598ecdbaa --- /dev/null +++ b/_javascripts_src/page.ts @@ -0,0 +1,24 @@ +var Page = { + SiteLinks: { + highlight: function () { + var current_page = location.pathname; + $("#header div.site-links a:not(.home)").each(function (i) { + if (current_page.indexOf($(this).attr('href')) == 0) { + $(this).addClass('selected'); + } + }); + + $("#home-page-layout #header div.site-links a.home").addClass('selected'); + }, + + menu: function () { + $("#header div.site-links a.menu").on('click touchstart', function (event) { + $(this).closest("div.site-links").toggleClass("open"); + event.preventDefault(); + }); + } + } +}; + +$(Page.SiteLinks.highlight); +$(Page.SiteLinks.menu); diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 0000000000..614e3240ff --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,9 @@ +{ + "compilerOptions": { + "outDir": "./javascripts", + + "target": "es5", + "strict": true + }, + "include": ["./_javascripts_src/**/*"] +} From 3b3c6774bd3b460de4495f465fa66d4a5a70146c Mon Sep 17 00:00:00 2001 From: Marcus Stollsteimer Date: Fri, 19 Feb 2021 17:36:24 +0100 Subject: [PATCH 0044/1090] Generate JavaScript files Generate JavaScript by running `tsc` in the root directory; used version: TypeScript 4.1.5. --- javascripts/examples.js | 1 + javascripts/page.js | 1 + 2 files changed, 2 insertions(+) diff --git a/javascripts/examples.js b/javascripts/examples.js index e810630024..3479a8c081 100644 --- a/javascripts/examples.js +++ b/javascripts/examples.js @@ -1,3 +1,4 @@ +"use strict"; var Examples = { names: ['cities', 'greeter', 'i_love_ruby', 'hello_world'], random: function () { diff --git a/javascripts/page.js b/javascripts/page.js index f807e2bf30..8aa18a025e 100644 --- a/javascripts/page.js +++ b/javascripts/page.js @@ -1,3 +1,4 @@ +"use strict"; var Page = { SiteLinks: { highlight: function () { From 1f896536a31d5f62eb375a436cd0228e62aaf857 Mon Sep 17 00:00:00 2001 From: Marcus Stollsteimer Date: Fri, 19 Feb 2021 22:39:27 +0100 Subject: [PATCH 0045/1090] Improve JavaScript Avoid an error reported by TypeScript 4.1.5 (`href` might be undefined). _javascripts_src/page.ts:6:34 - error TS2345: Argument of type 'string | undefined' is not assignable to parameter of type 'string'. Type 'undefined' is not assignable to type 'string'. 6 if (current_page.indexOf($(this).attr('href')) == 0) { ~~~~~~~~~~~~~~~~~~~~ --- _javascripts_src/page.ts | 3 ++- javascripts/page.js | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/_javascripts_src/page.ts b/_javascripts_src/page.ts index 8598ecdbaa..5bfbe0ff5b 100644 --- a/_javascripts_src/page.ts +++ b/_javascripts_src/page.ts @@ -3,7 +3,8 @@ var Page = { highlight: function () { var current_page = location.pathname; $("#header div.site-links a:not(.home)").each(function (i) { - if (current_page.indexOf($(this).attr('href')) == 0) { + let element_href = $(this).attr('href'); + if (element_href && current_page.indexOf(element_href) == 0) { $(this).addClass('selected'); } }); diff --git a/javascripts/page.js b/javascripts/page.js index 8aa18a025e..02e22fb64e 100644 --- a/javascripts/page.js +++ b/javascripts/page.js @@ -4,7 +4,8 @@ var Page = { highlight: function () { var current_page = location.pathname; $("#header div.site-links a:not(.home)").each(function (i) { - if (current_page.indexOf($(this).attr('href')) == 0) { + var element_href = $(this).attr('href'); + if (element_href && current_page.indexOf(element_href) == 0) { $(this).addClass('selected'); } }); From 46b7ef909db91c5b6c1b5ba4314abeb20e56df5d Mon Sep 17 00:00:00 2001 From: Marcus Stollsteimer Date: Fri, 29 Oct 2021 23:37:40 +0200 Subject: [PATCH 0046/1090] Use named link references on user-groups page (en) (#2716) Also use better link name for onruby-github and remove a surplus space. --- en/community/user-groups/index.md | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/en/community/user-groups/index.md b/en/community/user-groups/index.md index fb346e14d0..cd920d5f1d 100644 --- a/en/community/user-groups/index.md +++ b/en/community/user-groups/index.md @@ -21,16 +21,16 @@ to giving people a chance to write Ruby code). Information about Ruby user groups can be found on various websites: -[Ruby Meetup Groups][1] +[Ruby Meetup Groups][meetup] : A substantial number of Ruby User Groups have chosen to make Meetup their home. Meetup provides a number of tools for user groups, including: private forums, a place for announcements, automated meeting reminders, and a nice RSVP system. -[OnRuby][2] -: A number of user groups can also be found at OnRuby. OnRuby is an +[OnRuby][onruby] +: A number of user groups can also be found at OnRuby. OnRuby is an open source platform written in Ruby that can be used to organize - meetups. It is available on [GitHub][3]. + meetups. It is [available on GitHub][onruby-github]. ### Organizing Your Own Group @@ -39,6 +39,8 @@ there is already a Ruby user group in your area. Larger meetings are usually much more fun, so starting your own group may not be the best option if there is already one nearby. -[1]: https://ruby.meetup.com -[2]: https://www.onruby.eu/ -[3]: https://github.com/phoet/on_ruby + + +[meetup]: https://ruby.meetup.com +[onruby]: https://www.onruby.eu/ +[onruby-github]: https://github.com/phoet/on_ruby From 2a8541a6cee7df2c3e656cdd2049491fbf91bd07 Mon Sep 17 00:00:00 2001 From: Marcus Stollsteimer Date: Sat, 30 Oct 2021 17:34:43 +0200 Subject: [PATCH 0047/1090] Use named link reference on user-groups page (translations) Also use https instead of http. --- bg/community/user-groups/index.md | 4 ++-- de/community/user-groups/index.md | 4 ++-- es/community/user-groups/index.md | 4 ++-- fr/community/user-groups/index.md | 8 ++++---- id/community/user-groups/index.md | 4 ++-- it/community/user-groups/index.md | 4 ++-- ko/community/user-groups/index.md | 4 ++-- pl/community/user-groups/index.md | 4 ++-- pt/community/user-groups/index.md | 4 ++-- ru/community/user-groups/index.md | 4 ++-- tr/community/user-groups/index.md | 4 ++-- vi/community/user-groups/index.md | 4 ++-- zh_cn/community/user-groups/index.md | 4 ++-- zh_tw/community/user-groups/index.md | 4 ++-- 14 files changed, 30 insertions(+), 30 deletions(-) diff --git a/bg/community/user-groups/index.md b/bg/community/user-groups/index.md index 0660251917..dd7256eb15 100644 --- a/bg/community/user-groups/index.md +++ b/bg/community/user-groups/index.md @@ -20,7 +20,7 @@ lang: bg Информация за Ruby потребителски групи можете да намерите на следните сайтове: -[Ruby Meetup Groups][1] +[Ruby Meetup Groups][meetup] : Meetup предоставя: частни форуми, място за съобщения и публикации, напомняне за събирания и RSVP система. @@ -33,4 +33,4 @@ lang: bg -[1]: https://ruby.meetup.com +[meetup]: https://ruby.meetup.com diff --git a/de/community/user-groups/index.md b/de/community/user-groups/index.md index 2471f0c7c3..815caab30b 100644 --- a/de/community/user-groups/index.md +++ b/de/community/user-groups/index.md @@ -30,7 +30,7 @@ Ruby User Groups: : Eine Wikiseite mit bereits vorhandenen deutschsprachigen Ruby User Groups. -[onruby.de][3] +[onruby.de][onruby-de] : Ein Planungsportal für Ruby-Usergruppen in Deutschland. Kontaktinfos auf den jeweiligen Usergroup-Seiten. @@ -48,4 +48,4 @@ Interessierte deine Gruppe finden. [1]: http://maps.google.de/maps/ms?ie=UTF8&t=h&hl=de&msa=0&msid=111007145847842353754.00046e5ff7baba4a38734&ll=50.847573,11.513672&spn=7.534777,18.303223&z=6 [2]: http://wiki.ruby-portal.de/Usergroups -[3]: http://www.onruby.de/ +[onruby-de]: https://www.onruby.de/ diff --git a/es/community/user-groups/index.md b/es/community/user-groups/index.md index e4ac3cfbce..e3654216e1 100644 --- a/es/community/user-groups/index.md +++ b/es/community/user-groups/index.md @@ -32,7 +32,7 @@ Algunos grupos que pueden resultar de tu interés: [RUGUY][3] : Grupo de Usuarios de Ruby del Uruguay. -[Ruby Meetup Groups][4] +[Ruby Meetup Groups][meetup] : Varios grupos de usuarios Ruby han hecho de Meetup su hogar. Meetup provee una cantidad de herramientas para grupos de usuarios, incluyendo: foros privados, un lugar para anuncios, recordatorios @@ -43,4 +43,4 @@ Algunos grupos que pueden resultar de tu interés: [1]: http://rubysur.org/ [2]: http://ruby.com.ar/ [3]: http://ruguy.org/ -[4]: https://ruby.meetup.com +[meetup]: https://ruby.meetup.com diff --git a/fr/community/user-groups/index.md b/fr/community/user-groups/index.md index 272858e538..b55a31ca18 100644 --- a/fr/community/user-groups/index.md +++ b/fr/community/user-groups/index.md @@ -30,7 +30,7 @@ pour le partage des connaissances et, si vous êtes chanceux, des réunions et conférences (la mode étant aux barcamp, rencontres autour d’un verre dans un lieu adapté aux présentations). -[Meetup][2] +[Meetup][meetup] : Un nombre non négligeable de groupes ont choisi de promouvoir leurs évènements chez Meetup. Cet outil propose des services variés concernant la gestion d’un groupe, notamment un forum privé, un @@ -102,8 +102,8 @@ détail [comment organiser un apéro Ruby][19]. -[2]: http://ruby.meetup.com -[3]: http://www.meetup.com/parisrb/ +[meetup]: https://ruby.meetup.com +[3]: https://www.meetup.com/parisrb/ [4]: http://groups.google.com/group/parisrb [5]: http://lyonrb.fr/ [6]: http://rulu.eu/ @@ -118,5 +118,5 @@ détail [comment organiser un apéro Ruby][19]. [15]: http://rivierarb.fr/ [16]: http://www.facebook.com/AperoRubyMontpellier [17]: http://rubybdx.org/ -[18]: http://www.meetup.com/Orleans-rb/ +[18]: https://www.meetup.com/Orleans-rb/ [19]: http://www.camilleroux.com/2011/09/15/comment-organiser-un-apero-ruby/ diff --git a/id/community/user-groups/index.md b/id/community/user-groups/index.md index fe9487280f..ba6d221405 100644 --- a/id/community/user-groups/index.md +++ b/id/community/user-groups/index.md @@ -39,7 +39,7 @@ Kelompok pengguna Ruby dapat ditemukan di situs-situs berikut ini: dan informasi singkat mengenai masing-masing kelompok. Situs ini bersifat seperti wiki dan dapat diedit oleh siapa saja. -[Kelompok Ruby di Meetup][4] +[Kelompok Ruby di Meetup][meetup] : Sejumlah besar kelompok pengguna Ruby bergabung dalam Meetup. Meetup menyediakan banyak fasilitas untuk kelompok pengguna, seperti forum internal, pengumuman, pengingat otomatis, dan sistem RSVP. @@ -61,5 +61,5 @@ Ruby yang Anda ikuti dapat kita sampaikan di sini. [1]: http://tech.groups.yahoo.com/group/id-ruby/ [2]: http://wiki.rubygarden.org/Ruby/page/show/RubyUserGroups [3]: http://www.rubyholic.com/ -[4]: http://ruby.meetup.com +[meetup]: https://ruby.meetup.com [5]: http://groups.google.com/group/Ruby-Brigades diff --git a/it/community/user-groups/index.md b/it/community/user-groups/index.md index 17500788a2..7099f467f2 100644 --- a/it/community/user-groups/index.md +++ b/it/community/user-groups/index.md @@ -24,7 +24,7 @@ scrivere codice Ruby). Informazioni su i gruppi di utilizzatori Ruby possono essere trovate su diversi siti Web: -[Ruby Meetup Groups][1] +[Ruby Meetup Groups][meetup] : Un numero sostanziale di gruppi di utenti Ruby hanno scelto di fare di Meetup la loro dimora. Meetup fornisce un numero di tool per i gruppi di utenti, fra i quali: forum privati, una bacheca per @@ -41,4 +41,4 @@ già uno nella tua area. -[1]: https://ruby.meetup.com +[meetup]: https://ruby.meetup.com diff --git a/ko/community/user-groups/index.md b/ko/community/user-groups/index.md index 6ff50aec85..14be151603 100644 --- a/ko/community/user-groups/index.md +++ b/ko/community/user-groups/index.md @@ -19,7 +19,7 @@ Ruby 유저 그룹은 전적으로 Ruby에만 전념합니다. 일반적으로 Ruby 유저 그룹에 관한 정보는 여러 웹 사이트에서 얻을 수 있습니다. -[Ruby Meetup Groups][1] +[Ruby Meetup Groups][meetup] : Ruby 유저 그룹의 상당수는 Meetup 사이트를 홈페이지로 합니다. Meetup은 유저 그룹을 위한 몇 가지 툴을 제공하고 있습니다. 비공개 포럼, 공지를 위한 장소, 자동 리마인더, 훌륭한 RSVP(참석여부 체크) 시스템 등등이 그것이죠. @@ -32,4 +32,4 @@ Ruby 유저 그룹에 관한 정보는 여러 웹 사이트에서 얻을 수 있 -[1]: https://ruby.meetup.com +[meetup]: https://ruby.meetup.com diff --git a/pl/community/user-groups/index.md b/pl/community/user-groups/index.md index e7fd7cfcf1..cdee5edad9 100644 --- a/pl/community/user-groups/index.md +++ b/pl/community/user-groups/index.md @@ -34,7 +34,7 @@ poniższych stronach: grupy. Ta strona przypomina Wiki, czyli każdy może edytować dowolne informacje znajdujące się na niej. -[Ruby Meetup Groups][3] +[Ruby Meetup Groups][meetup] : Spora liczba grup użytkowników Rubiego zdecydowała sie wykorzystać serwis meetup.com jako swoje miejsce w sieci. Meetup zapewnia zestaw narzędzi dla grup użytkowników m.in.: prywatne fora dyskusyjne, @@ -53,5 +53,5 @@ ludzi, którzy chcą dowiedzieć się co się dzieje w innych grupach. [1]: http://wiki.rubygarden.org/Ruby/page/show/RubyUserGroups [2]: http://www.rubyholic.com/ -[3]: http://ruby.meetup.com +[meetup]: https://ruby.meetup.com [4]: http://groups.google.com/group/Ruby-Brigades diff --git a/pt/community/user-groups/index.md b/pt/community/user-groups/index.md index aad0a0a29c..4ce05a71a3 100644 --- a/pt/community/user-groups/index.md +++ b/pt/community/user-groups/index.md @@ -23,7 +23,7 @@ dedicadas a dar a oportunidade aos membros de escrever código em Ruby). Informações sobre grupos de usuários de Ruby podem ser encontrados pelo menos em vários websites: -[Ruby Meetup Groups][1] +[Ruby Meetup Groups][meetup] : Um número substancial de Grupos de Usuários de Ruby decidiram usar o Meetup como o seu lar. O Meetup oferece um número de ferramentas incluindo: fóruns privados, um local para colocar anúncios, lembretes @@ -38,4 +38,4 @@ não ser a melhor opção se já existir um por perto. -[1]: https://ruby.meetup.com +[meetup]: https://ruby.meetup.com diff --git a/ru/community/user-groups/index.md b/ru/community/user-groups/index.md index 31243f3f84..462793a857 100644 --- a/ru/community/user-groups/index.md +++ b/ru/community/user-groups/index.md @@ -24,7 +24,7 @@ Ruby целиком посвящены Ruby. Обычно они включаю Информацию о группах пользователей Ruby вы можете найти на различных веб-сайтах: -[Ruby Meetup Groups][1] +[Ruby Meetup Groups][meetup] : Некоторые из групп пользователей Ruby выбирают Meetup в качестве места их встреч. Meetup предоставляет набор инструментов для групп пользователей, таких как: приватные форму, место для объявлений, автоматические @@ -39,4 +39,4 @@ Ruby целиком посвящены Ruby. Обычно они включаю -[1]: https://ruby.meetup.com +[meetup]: https://ruby.meetup.com diff --git a/tr/community/user-groups/index.md b/tr/community/user-groups/index.md index 0406b7600a..3cad20c8be 100644 --- a/tr/community/user-groups/index.md +++ b/tr/community/user-groups/index.md @@ -20,7 +20,7 @@ bir websitesi, ve eğer şanslıysanız, sık kod yazma oturumları sağlar. Ruby kullanıcı grupları hakkında bilgiler çeşitli websitelerinde bulunabilir: -[Ruby Meetup Groups][1] +[Ruby Meetup Groups][meetup] : Ruby Kullanıcı Grupları'nın önemli bir kısmı evleri olarak Meetup'ı seçmiştir. Meetup, kullanıcı grupları için bazı araçlar sunar. Bunlardan bazıları şunlardır: özel forumlar, duyurular için bir ortam, otomatik buluşma @@ -35,4 +35,4 @@ bir seçenek olmayabilir. -[1]: https://ruby.meetup.com +[meetup]: https://ruby.meetup.com diff --git a/vi/community/user-groups/index.md b/vi/community/user-groups/index.md index dfd69471af..5ca7729c16 100644 --- a/vi/community/user-groups/index.md +++ b/vi/community/user-groups/index.md @@ -22,7 +22,7 @@ buổi thảo luận này dành cho mọi người cơ hội để viết code R Thông tin về các nhóm người dùng Ruby có thể tìm thấy trên những website khác nhau như: -[Các nhóm Ruby Meetup][1] +[Các nhóm Ruby Meetup][meetup] : Đa số các nhóm người dùng Ruby đều chọn Meetup làm ngôi nhà chung. Meetup cung cấp một số công cụ cho những nhóm người dùng bao gồm: diễn đàn riêng, nơi thông báo cho nhóm, tự động nhắc nhở khi có cuộc thảo luận nhóm nào được tổ @@ -37,4 +37,4 @@ nếu đã có một nhóm trong khu vực đó rồi. -[1]: https://ruby.meetup.com +[meetup]: https://ruby.meetup.com diff --git a/zh_cn/community/user-groups/index.md b/zh_cn/community/user-groups/index.md index 5061041934..d188339ec6 100644 --- a/zh_cn/community/user-groups/index.md +++ b/zh_cn/community/user-groups/index.md @@ -15,7 +15,7 @@ Ruby 的,他们最典型的特征是有月度聚会、邮件列表、 web 站 关于 Ruby 用户组的信息可以在各种网站找到: -[Ruby Meetup Groups][1] +[Ruby Meetup Groups][meetup] : 相当多的 Ruby 用户组在 Meetup 安家,Meetup 为用户组提供了许多工具,包括:私人论坛、 公告栏、自动会议提醒和一个非常棒的 RSVP 系统。 @@ -24,4 +24,4 @@ Ruby 的,他们最典型的特征是有月度聚会、邮件列表、 web 站 如果你对创建自己的用户组感兴趣,一定要看看在你的区域是否已经有一个。通常越大的聚会越有趣,如果在你的附近已经有一个用户组,创建你自己的用户组也许不是一个非常好的选择。 -[1]: https://ruby.meetup.com +[meetup]: https://ruby.meetup.com diff --git a/zh_tw/community/user-groups/index.md b/zh_tw/community/user-groups/index.md index ea58674d42..a47d48df86 100644 --- a/zh_tw/community/user-groups/index.md +++ b/zh_tw/community/user-groups/index.md @@ -13,7 +13,7 @@ lang: zh_tw 關於 Ruby 使用者群組的資訊可以在許多網站找到: -[Ruby Meetup Groups][1] +[Ruby Meetup Groups][meetup] : 許多 Ruby 使用者群組選擇在 Meetup 建立自己的家, Meetup 提供許多群組工具,包含:私密論壇、公佈欄、自動聚會提醒、還有一個很棒的 RSVP 系統。 ### 組織您自己的使用者群組 @@ -22,4 +22,4 @@ lang: zh_tw -[1]: https://ruby.meetup.com +[meetup]: https://ruby.meetup.com From dbeff98b7d4423a2e46a266471e5e33cf96e2468 Mon Sep 17 00:00:00 2001 From: Vlad Bokov Date: Sun, 31 Oct 2021 23:11:04 +0300 Subject: [PATCH 0048/1090] Fix typos after spellchecker (ru) (#2719) --- ru/documentation/ruby-from-other-languages/index.md | 2 +- ru/news/_posts/2013-02-06-rdoc-xss-cve-2013-0256.md | 2 +- ...the-barcelona-ruby-conference-call-for-papers-is-open.md | 4 ++-- ru/news/_posts/2013-02-24-ruby-2-0-0-p0-is-released.md | 6 +++--- ...passing-vulnerability-in-openssl-client-cve-2013-4073.md | 4 ++-- ru/news/_posts/2013-06-27-ruby-1-9-3-p448-is-released.md | 2 +- ru/news/_posts/2013-06-27-ruby-2-0-0-p247-is-released.md | 2 +- ru/news/_posts/2013-06-30-we-retire-1-8-7.md | 2 +- ru/news/_posts/2013-08-06-status-issue.md | 2 +- ru/news/_posts/2013-11-22-ruby-1-9-3-p484-is-released.md | 2 +- ru/news/_posts/2013-11-22-ruby-2-0-0-p353-is-released.md | 2 +- ru/news/_posts/2013-12-17-maintenance-of-1-8-7-and-1-9-2.md | 2 +- ru/news/_posts/2013-12-20-ruby-2-1-0-rc1-is-released.md | 2 +- .../2013-12-21-ruby-version-policy-changes-with-2-1-0.md | 4 ++-- .../2014-03-10-regression-of-hash-reject-in-ruby-2-1-1.md | 2 +- ru/news/_posts/2014-03-15-eurucamp-2014.md | 2 +- .../2014-10-27-changing-default-settings-of-ext-openssl.md | 4 ++-- ru/news/_posts/2016-11-21-ruby-2-3-3-released.md | 2 +- ru/news/_posts/2016-12-25-ruby-2-4-0-released.md | 2 +- ru/news/_posts/2017-12-25-ruby-2-5-0-released.md | 2 +- 20 files changed, 26 insertions(+), 26 deletions(-) diff --git a/ru/documentation/ruby-from-other-languages/index.md b/ru/documentation/ruby-from-other-languages/index.md index a5495bea5b..9121e6b985 100644 --- a/ru/documentation/ruby-from-other-languages/index.md +++ b/ru/documentation/ruby-from-other-languages/index.md @@ -284,7 +284,7 @@ Time.mktime(2006, 01, 01) + 14.hours В Ruby имена методов могут оканчиваться на вопросительный или восклицательный знаки. По соглашению методы, которые отвечают на вопрос, заканчиваются вопросительным знаком (например, `Array#empty?` возвращает **true** если массив пустой). -Некоторые, "потенциально опасные" методы (которые меняют вызывающую сторонy, **self** +Некоторые, "потенциально опасные" методы (которые меняют вызывающую сторону, **self** или параметры) заканчиваются восклицательным знаком (например, `exit!`). Однако не все методы, которые меняют аргументы заканчиваются так, например `Array#replace` заменяет содержимое массива переданным массивом. Просто нет смысла иметь метод, diff --git a/ru/news/_posts/2013-02-06-rdoc-xss-cve-2013-0256.md b/ru/news/_posts/2013-02-06-rdoc-xss-cve-2013-0256.md index 129ec19fb6..6d171b95a8 100644 --- a/ru/news/_posts/2013-02-06-rdoc-xss-cve-2013-0256.md +++ b/ru/news/_posts/2013-02-06-rdoc-xss-cve-2013-0256.md @@ -18,7 +18,7 @@ RDoc. RDoc документация, сгенерированная rdoc 2.3.0 по rdoc 3.12 и пререлизы до rdoc 4.0.0.preview2.1, уязвима к XSS эксплоиту. Эксплоит может -привести к раскрытию кук третьей стороне. +привести к раскрытию cookies третьей стороне. ## Детали diff --git a/ru/news/_posts/2013-02-16-the-barcelona-ruby-conference-call-for-papers-is-open.md b/ru/news/_posts/2013-02-16-the-barcelona-ruby-conference-call-for-papers-is-open.md index 2939f59b3e..fe186572fa 100644 --- a/ru/news/_posts/2013-02-16-the-barcelona-ruby-conference-call-for-papers-is-open.md +++ b/ru/news/_posts/2013-02-16-the-barcelona-ruby-conference-call-for-papers-is-open.md @@ -9,8 +9,8 @@ lang: ru **[Barcelona Ruby Conference][1]** – это конференция, которая проходит в сердце **Каталонии, Испания** 14-15 сентября. Выступают [спикеры мирового -класса][2], такие как **Aaron Patterson** (кортим rails и ruby), -**David Chelimsky** (автор *The RSpec book*, RSpec кортим), +класса][2], такие как **Aaron Patterson** (ключевой разработчик rails и ruby), +**David Chelimsky** (автор *The RSpec book*, ключевой разработчик RSpec), **Charles Nutter** (JRuby ментейнер), **Sandi Metz** (автор *Practical Object-Oriented Design in Ruby*) или **Yukihiro Matz** (создатель языка Ruby ), и многие другие. diff --git a/ru/news/_posts/2013-02-24-ruby-2-0-0-p0-is-released.md b/ru/news/_posts/2013-02-24-ruby-2-0-0-p0-is-released.md index 4e0e6b33ff..61040b249b 100644 --- a/ru/news/_posts/2013-02-24-ruby-2-0-0-p0-is-released.md +++ b/ru/news/_posts/2013-02-24-ruby-2-0-0-p0-is-released.md @@ -70,7 +70,7 @@ Ruby 2.0.0 – это первый стабильный релиз Ruby 2.0 се * Оптимизации виртуальной машины, например, отправки метода * Операции с дробными числами -Можно добавить, что хотя как и эксперемент, но 2.0.0 включает +Можно добавить, что хотя как и эксперимент, но 2.0.0 включает Refinements, который добавляет новый концепт к модульности Ruby. Также, просмотрите новости про другие изменения, улучшения и детали. @@ -166,9 +166,9 @@ Ruby жизнь. Мы добавили фичу под названием Refinements, которая добавляет новый концепт к модульности Ruby. Не смотря на это, пожалуйста, знайте, что -Refinements до сих пор эксперементальная фича: мы можем изменить ее +Refinements до сих пор экспериментальная фича: мы можем изменить ее спецификацию в будущем. Но мы бы хотели, чтобы вы поиграли с ней, -отправлии бы нам свои отзывы, поделились мыслями. +отправили бы нам свои отзывы, поделились мыслями. Ваши отзывы очень помогут доделать эту интересную фичу. diff --git a/ru/news/_posts/2013-06-27-hostname-check-bypassing-vulnerability-in-openssl-client-cve-2013-4073.md b/ru/news/_posts/2013-06-27-hostname-check-bypassing-vulnerability-in-openssl-client-cve-2013-4073.md index e24cfe9e0d..8b526933cf 100644 --- a/ru/news/_posts/2013-06-27-hostname-check-bypassing-vulnerability-in-openssl-client-cve-2013-4073.md +++ b/ru/news/_posts/2013-06-27-hostname-check-bypassing-vulnerability-in-openssl-client-cve-2013-4073.md @@ -9,8 +9,8 @@ lang: ru --- Уязвимость в SSL клиенте Ruby, которая может позволить man-in-the-middle -(человек-посередине) атаки, чтобы обмнауть SSL сервера через -использование валидного сертефиката, выданного доверенным центром +(человек-посередине) атаки, чтобы обмануть SSL сервера через +использование валидного сертификата, выданного доверенным центром сертификации. Этой уязвимости был назначен CVE идентификатор CVE-2013-4073. diff --git a/ru/news/_posts/2013-06-27-ruby-1-9-3-p448-is-released.md b/ru/news/_posts/2013-06-27-ruby-1-9-3-p448-is-released.md index 05f793b05e..f642ccf559 100644 --- a/ru/news/_posts/2013-06-27-ruby-1-9-3-p448-is-released.md +++ b/ru/news/_posts/2013-06-27-ruby-1-9-3-p448-is-released.md @@ -9,7 +9,7 @@ lang: ru Вышел Ruby 1.9.3-p448. -Данный релиз включает исправлениие проблемы безопасности со встроенным +Данный релиз включает исправление проблемы безопасности со встроенным OpenSSL. * [Hostname check bypassing vulnerability in SSL client diff --git a/ru/news/_posts/2013-06-27-ruby-2-0-0-p247-is-released.md b/ru/news/_posts/2013-06-27-ruby-2-0-0-p247-is-released.md index 1ce99c84ec..91583894cb 100644 --- a/ru/news/_posts/2013-06-27-ruby-2-0-0-p247-is-released.md +++ b/ru/news/_posts/2013-06-27-ruby-2-0-0-p247-is-released.md @@ -9,7 +9,7 @@ lang: ru Вышел Ruby 2.0.0-p247. -Данный релиз включает исправлениие проблемы безопасности со встроенным +Данный релиз включает исправление проблемы безопасности со встроенным OpenSSL. * [Hostname check bypassing vulnerability in SSL client diff --git a/ru/news/_posts/2013-06-30-we-retire-1-8-7.md b/ru/news/_posts/2013-06-30-we-retire-1-8-7.md index 7cca8648ac..8e48bdd2b8 100644 --- a/ru/news/_posts/2013-06-30-we-retire-1-8-7.md +++ b/ru/news/_posts/2013-06-30-we-retire-1-8-7.md @@ -45,5 +45,5 @@ Ruby. быть, а может и не быть, поддерживаем кем-либо еще, потому что существуют сторонние организации, которые занимаются поддержкой Ruby 1.8.7. Единственная вещь, которую я могу сказать, это _Я_ не хочу -поддержвить его больше. Так что, если вы используете то, что опубликовал +поддерживать его больше. Так что, если вы используете то, что опубликовал я, смотрите внимательней и ищите решения, подходящие к вашей ситуации. diff --git a/ru/news/_posts/2013-08-06-status-issue.md b/ru/news/_posts/2013-08-06-status-issue.md index 6f2ffb1bfd..bdddcd1671 100644 --- a/ru/news/_posts/2013-08-06-status-issue.md +++ b/ru/news/_posts/2013-08-06-status-issue.md @@ -40,7 +40,7 @@ lang: ru ## Обновление (2013-08-07 05:08 UTC) -Мы подтвердили, что следующие пакеты сломаны. Эти покеты доступны на http://mirrorservice.org/sites/ftp.ruby-lang.org/pub/ruby/ +Мы подтвердили, что следующие пакеты сломаны. Эти пакеты доступны на http://mirrorservice.org/sites/ftp.ruby-lang.org/pub/ruby/
 ruby-1.9.3-p426.tar.bz2
 ruby-1.9.3-p426.tar.gz
diff --git a/ru/news/_posts/2013-11-22-ruby-1-9-3-p484-is-released.md b/ru/news/_posts/2013-11-22-ruby-1-9-3-p484-is-released.md
index 592cae6ea5..49245f27c2 100644
--- a/ru/news/_posts/2013-11-22-ruby-1-9-3-p484-is-released.md
+++ b/ru/news/_posts/2013-11-22-ruby-1-9-3-p484-is-released.md
@@ -9,7 +9,7 @@ lang: ru
 
 Вышел Ruby 1.9.3-p484.
 
-Данный релиз включает исправлениие проблемы безопасности в ядре Ruby:
+Данный релиз включает исправление проблемы безопасности в ядре Ruby:
 
  * [Переполнение кучи при парсинге плавающей запятой (CVE-2013-4164)](/ru/news/2013/11/22/heap-overflow-in-floating-point-parsing-cve-2013-4164/)
 
diff --git a/ru/news/_posts/2013-11-22-ruby-2-0-0-p353-is-released.md b/ru/news/_posts/2013-11-22-ruby-2-0-0-p353-is-released.md
index 18e2899206..4849999fb9 100644
--- a/ru/news/_posts/2013-11-22-ruby-2-0-0-p353-is-released.md
+++ b/ru/news/_posts/2013-11-22-ruby-2-0-0-p353-is-released.md
@@ -9,7 +9,7 @@ lang: ru
 
 Вышел Ruby 2.0.0-p353.
 
-Данный релиз включает исправлениие проблемы безопасности в ядре Ruby:
+Данный релиз включает исправление проблемы безопасности в ядре Ruby:
 
 * [Переполнение кучи при парсинге плавающей запятой (CVE-2013-4164)](/ru/news/2013/11/22/heap-overflow-in-floating-point-parsing-cve-2013-4164/)
 
diff --git a/ru/news/_posts/2013-12-17-maintenance-of-1-8-7-and-1-9-2.md b/ru/news/_posts/2013-12-17-maintenance-of-1-8-7-and-1-9-2.md
index ae6ab37c4f..3631615ab4 100644
--- a/ru/news/_posts/2013-12-17-maintenance-of-1-8-7-and-1-9-2.md
+++ b/ru/news/_posts/2013-12-17-maintenance-of-1-8-7-and-1-9-2.md
@@ -44,7 +44,7 @@ lang: ru
 
 ### Зачем "откапывать" 1.8.7?
 
-Около 6 месяцев назал было объявлено [о закате 1.8.7][sunset-187-ru].
+Около 6 месяцев назад было объявлено [о закате 1.8.7][sunset-187-ru].
 
 В то время как команда ruby-core не собирается более поддерживать 1.8.7 и 1.9.2,
 Terence и Zachary будут поддерживать безопасность этих версий в рамках корпоративного
diff --git a/ru/news/_posts/2013-12-20-ruby-2-1-0-rc1-is-released.md b/ru/news/_posts/2013-12-20-ruby-2-1-0-rc1-is-released.md
index 0b4f845206..4a462636a4 100644
--- a/ru/news/_posts/2013-12-20-ruby-2-1-0-rc1-is-released.md
+++ b/ru/news/_posts/2013-12-20-ruby-2-1-0-rc1-is-released.md
@@ -49,7 +49,7 @@ lang: ru
 * "literal".freeze теперь оптимизирован [#9042](https://bugs.ruby-lang.org/issues/9042)
 * добавлен Exception#cause [#8257](https://bugs.ruby-lang.org/issues/8257)
 * обновлены библиотеки, такие как json, nkf, rake, RubyGems, и RDoc.
-* удалена бибиотека curses. [#8584](https://bugs.ruby-lang.org/issues/8584)
+* удалена библиотека curses. [#8584](https://bugs.ruby-lang.org/issues/8584)
 
 Смотри больше подробностей об изменениях: [NEWS in Ruby repository (WIP)](https://github.com/ruby/ruby/blob/v2_1_0_preview2/NEWS).
 
diff --git a/ru/news/_posts/2013-12-21-ruby-version-policy-changes-with-2-1-0.md b/ru/news/_posts/2013-12-21-ruby-version-policy-changes-with-2-1-0.md
index 70286f4183..8629060534 100644
--- a/ru/news/_posts/2013-12-21-ruby-version-policy-changes-with-2-1-0.md
+++ b/ru/news/_posts/2013-12-21-ruby-version-policy-changes-with-2-1-0.md
@@ -39,8 +39,8 @@ lang: ru
 Следующие характерные изменения будут считаться несовместимыми,
 увеличивая `MINOR` версию:
 
-* yдаление возможностей низкоуровнего С API;
-* oбратно-несовместимые изменения или добавления.
+* удаление возможностей низкоуровнего С API;
+* обратно-несовместимые изменения или добавления.
 
 ### Совместимость ABI
 
diff --git a/ru/news/_posts/2014-03-10-regression-of-hash-reject-in-ruby-2-1-1.md b/ru/news/_posts/2014-03-10-regression-of-hash-reject-in-ruby-2-1-1.md
index d29f6ceccf..b64ff35760 100644
--- a/ru/news/_posts/2014-03-10-regression-of-hash-reject-in-ruby-2-1-1.md
+++ b/ru/news/_posts/2014-03-10-regression-of-hash-reject-in-ruby-2-1-1.md
@@ -9,7 +9,7 @@ lang: ru
 
 В Ruby 2.1.0 и ранее метод `reject` любого класса, отнаследованного от `Hash`,
 возвращал объект этого же класса.
-Однако, в Ruby 2.1.1 это поведение неожиденно изменилось, и метод всегда возвращает
+Однако, в Ruby 2.1.1 это поведение неожиданно изменилось, и метод всегда возвращает
 простой `Hash`, а не унаследованный класс.
 
 {% highlight ruby %}
diff --git a/ru/news/_posts/2014-03-15-eurucamp-2014.md b/ru/news/_posts/2014-03-15-eurucamp-2014.md
index dd4e40d49e..93e1b28c6f 100644
--- a/ru/news/_posts/2014-03-15-eurucamp-2014.md
+++ b/ru/news/_posts/2014-03-15-eurucamp-2014.md
@@ -21,7 +21,7 @@ lang: ru
 
 eurucamp - это летняя конференция с обширными возможностями пообщаться и воплотить свои идеи.
 Вдохновитесь [видео с конференции 2012][5] на нашей [странице Vimeo][6]!
-Также, можно посмотреть на [расписание][7] как пример того, что происхожит на и вне конференции.
+Также, можно посмотреть на [расписание][7] как пример того, что происходит на и вне конференции.
 
 eurucamp строго следует [кодексу проведения][8].
 Мы рады гостям, приезжающим вместе с семьей и детьми, а также людями с физическими ограничениями.
diff --git a/ru/news/_posts/2014-10-27-changing-default-settings-of-ext-openssl.md b/ru/news/_posts/2014-10-27-changing-default-settings-of-ext-openssl.md
index cd2d360457..40e920a8bb 100644
--- a/ru/news/_posts/2014-10-27-changing-default-settings-of-ext-openssl.md
+++ b/ru/news/_posts/2014-10-27-changing-default-settings-of-ext-openssl.md
@@ -17,7 +17,7 @@ lang: ru
 OpenSSL до сих пор реализует протоколы и шифры, исторически признанные небезопасными на сегодняшний день.
 Например, POODLE уязвимость ([CVE-2014-3566](http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2014-3566)).
 Если вы продолжите использовать OpenSSL с подобными небезопасными фичами, возможно, вы не сможете обеспечить безопасность
-сетвых коммуникаций. Так, основываясь на дискуссии в [Bug #9424](https://bugs.ruby-lang.org/issues/9424),
+сетевых коммуникаций. Так, основываясь на дискуссии в [Bug #9424](https://bugs.ruby-lang.org/issues/9424),
 мы решили отключить подобные опции для SSL/TLS по умолчанию.
 Если вам надо отменить эти изменения (показанные ниже), примените обратный патч, чтобы включить эти опции снова.
 
@@ -31,7 +31,7 @@ OpenSSL до сих пор реализует протоколы и шифры,
 : [r48121](https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?revision=48121&view=revision)
 
 В любом случае, если вы отмените эти изменения, есть риск, что вы не сможете гарантировать безопасность сетевых коммуникаций.
-Вы должны понимать последстивя этих изменений, прежде чем отменять их.
+Вы должны понимать последстивия этих изменений, прежде чем отменять их.
 
 ### Встроенные библиотеки Ruby
 
diff --git a/ru/news/_posts/2016-11-21-ruby-2-3-3-released.md b/ru/news/_posts/2016-11-21-ruby-2-3-3-released.md
index 1173512431..b462bc5df5 100644
--- a/ru/news/_posts/2016-11-21-ruby-2-3-3-released.md
+++ b/ru/news/_posts/2016-11-21-ruby-2-3-3-released.md
@@ -10,7 +10,7 @@ lang: ru
 Вышел релиз Ruby 2.3.3.
 
 Этот релиз содержит исправления ошибок с `Refinements` и `Module#prepend`.
-Соместное использование `Module#refine` и `Module#prepend` в рамках одного
+Совместное использование `Module#refine` и `Module#prepend` в рамках одного
 класса могло неожиданно привести к появлению ошибки `NoMethodError`.
 Это является следствием регрессии в последнем релизе Ruby 2.3.2 на предыдущей
 неделе. Подробности доступны по адресу [Bug #12920](https://bugs.ruby-lang.org/issues/12920).
diff --git a/ru/news/_posts/2016-12-25-ruby-2-4-0-released.md b/ru/news/_posts/2016-12-25-ruby-2-4-0-released.md
index a4519fbd5f..d4bc9d7ada 100644
--- a/ru/news/_posts/2016-12-25-ruby-2-4-0-released.md
+++ b/ru/news/_posts/2016-12-25-ruby-2-4-0-released.md
@@ -61,7 +61,7 @@ Ruby 2.4 также реализует следующие улучшения п
 
 ### Прочие улучшения производительности
 
-* [ускорение доступа к переменным экземляров класса](https://bugs.ruby-lang.org/issues/12274)
+* [ускорение доступа к переменным экземпляров класса](https://bugs.ruby-lang.org/issues/12274)
 
 ## Поиск ошибок
 
diff --git a/ru/news/_posts/2017-12-25-ruby-2-5-0-released.md b/ru/news/_posts/2017-12-25-ruby-2-5-0-released.md
index 90b050f599..ce5292f95f 100644
--- a/ru/news/_posts/2017-12-25-ruby-2-5-0-released.md
+++ b/ru/news/_posts/2017-12-25-ruby-2-5-0-released.md
@@ -53,7 +53,7 @@ Ruby 2.5.0 является первой стабильной версией в
   `trace` из всего байт-кода (последовательности инструкций).
   Инструкция `trace` была добавлена для поддержки `TracePoint`,
   Тем не менее, в большинстве случаев `TracePoint` не используется и инструкции
-  `trace` это черезмерные накладные расходы. Вместо этого теперь мы
+  `trace` это чрезмерные накладные расходы. Вместо этого теперь мы
   используем технологию динамического инструментария. Больше информации об этом
   по ссылке [[Feature #14104]](https://bugs.ruby-lang.org/issues/14104).
 * Передача блока по параметру блока (прим. `def foo(&b); bar(&b); end`)

From 6a7a5ab61adef89651e61887b5dc9b56dfbadb70 Mon Sep 17 00:00:00 2001
From: Vlad Bokov 
Date: Sun, 31 Oct 2021 23:12:32 +0300
Subject: [PATCH 0049/1090] Mark Russian site maintained (ru) (#2721)

---
 ru/index.html | 2 --
 1 file changed, 2 deletions(-)

diff --git a/ru/index.html b/ru/index.html
index fd11f2159f..1b2a605214 100644
--- a/ru/index.html
+++ b/ru/index.html
@@ -25,5 +25,3 @@ 

Ruby это...

--- - -{% include unmaintained.html %} From e2e070d129859841d20938e2389ee48bfc8c4724 Mon Sep 17 00:00:00 2001 From: Marcus Stollsteimer Date: Sun, 31 Oct 2021 21:26:36 +0100 Subject: [PATCH 0050/1090] Remove Google Analytics --- _includes/analytics.html | 13 ------------- _layouts/default.html | 2 -- 2 files changed, 15 deletions(-) delete mode 100644 _includes/analytics.html diff --git a/_includes/analytics.html b/_includes/analytics.html deleted file mode 100644 index a7857b1cb9..0000000000 --- a/_includes/analytics.html +++ /dev/null @@ -1,13 +0,0 @@ - diff --git a/_layouts/default.html b/_layouts/default.html index 1dcd676b34..e963a7ce7a 100644 --- a/_layouts/default.html +++ b/_layouts/default.html @@ -78,7 +78,5 @@

{{ site.data.locales[page.lang].slogan }}

{% include credits.html %} - - {% include analytics.html %} From 16c3252e6cf2144eafc605d573d76a36740b6a15 Mon Sep 17 00:00:00 2001 From: Alexander Ilyin Date: Tue, 2 Nov 2021 23:17:00 +0300 Subject: [PATCH 0051/1090] Prepare ru locale maintained (ru) - set locale to admin/translation-status page - do redirect to locale from /index.html - see #2721 for more details --- _plugins/translation_status.rb | 2 +- index.html | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/_plugins/translation_status.rb b/_plugins/translation_status.rb index 65732e316b..0e7d1d53d8 100644 --- a/_plugins/translation_status.rb +++ b/_plugins/translation_status.rb @@ -8,7 +8,7 @@ module Jekyll # Outputs HTML. module TranslationStatus - LANGS = %w[en de es id ja ko pt tr zh_cn zh_tw].freeze + LANGS = %w[en de es id ja ko pt ru tr zh_cn zh_tw].freeze START_DATE = "2013-04-01" OK_CHAR = "✓" diff --git a/index.html b/index.html index a3024b2082..ee0dfd348b 100644 --- a/index.html +++ b/index.html @@ -11,6 +11,7 @@ "ja": "ja", "ko": "ko", "pt": "pt", + "ru": "ru", "tr": "tr", "zh-CN": "zh_cn", "zh-TW": "zh_tw" From f5f196e99cf93c820adb4152e876846f9fae240a Mon Sep 17 00:00:00 2001 From: Andrias Meisyal Date: Sat, 30 Oct 2021 19:24:34 +0700 Subject: [PATCH 0052/1090] Translate CVE-2021-31799: A command injection vulnerability in RDoc (id) --- ...2021-05-02-os-command-injection-in-rdoc.md | 54 +++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 id/news/_posts/2021-05-02-os-command-injection-in-rdoc.md diff --git a/id/news/_posts/2021-05-02-os-command-injection-in-rdoc.md b/id/news/_posts/2021-05-02-os-command-injection-in-rdoc.md new file mode 100644 index 0000000000..1fedaee221 --- /dev/null +++ b/id/news/_posts/2021-05-02-os-command-injection-in-rdoc.md @@ -0,0 +1,54 @@ +--- +layout: news_post +title: "CVE-2021-31799: Sebuah kerentanan command injection pada RDoc" +author: "aycabta" +translator: "meisyal" +date: 2021-05-02 09:00:00 +0000 +tags: security +lang: id +--- + +Ada sebuah kerentanan *Command Injection* pada RDoc yang di-*bundle* dengan +Ruby. Semua pengguna Ruby direkomendasikan untuk memperbarui RDoc ke versi +terbaru untuk memperbaiki kerentanan ini. + +## Detail + +Berikut adalah kerentanan yang telah dilaporkan. + +* [CVE-2021-31799](https://nvd.nist.gov/vuln/detail/CVE-2021-31799) + +RDoc sebelumnya memanggil `Kernel#open` untuk membuat sebuah berkas lokal. Jika +sebuah proyek Ruby memiliki sebuah berkas yang mana nama berkas dimulai dengan +`|` dan diakhiri `tags`, perintah yang mengikuti karater pipa akan dieksekusi. +Sebuah proyek Ruby yang berbahaya bisa saja memanfaatkan ini untuk menjalankan +sebuah perintah yang tidak seharusnya pada seorang pengguna yang mencoba untuk +menjalankan perintah `rdoc`. + +Pengguna Ruby yang terimbas dengan kerentanan ini seharusnya memperbarui RDoc +ke versi terbaru. + +## Versi Terimbas + +* Semua rilis RDoc dari 3.11 sampai 6.3.0 + +## Cara Memperbarui + +Jalankan perintah berikut untuk memperbarui RDoc ke versi terbaru (6.3.1 atau +setelahnya). + +``` +gem install rdoc +``` + +Jika Anda menggunakan *bundler*, mohon tambahkan `gem "rdoc", ">= 6.3.1"` pada +`Gemfile` Anda. + +## Rujukan + +Terima kasih kepada [Alexandr Savca](https://hackerone.com/chinarulezzz) yang +telah melaporkan kerentanan ini. + +## Riwayat + +* Semula dipublikasikan pada 2021-05-02 09:00:00 UTC From b7add26280870083b6eed0d79e18d5ae8da7e5a2 Mon Sep 17 00:00:00 2001 From: Yusuke Endoh Date: Sun, 7 Nov 2021 12:51:22 +0900 Subject: [PATCH 0053/1090] CVE-2021-41817: ReDoS of date parsing methods --- ...arsing-method-regexp-dos-cve-2021-41817.md | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 en/news/_posts/2021-11-15-date-parsing-method-regexp-dos-cve-2021-41817.md diff --git a/en/news/_posts/2021-11-15-date-parsing-method-regexp-dos-cve-2021-41817.md b/en/news/_posts/2021-11-15-date-parsing-method-regexp-dos-cve-2021-41817.md new file mode 100644 index 0000000000..6918d96ff1 --- /dev/null +++ b/en/news/_posts/2021-11-15-date-parsing-method-regexp-dos-cve-2021-41817.md @@ -0,0 +1,34 @@ +--- +layout: news_post +title: "CVE-2021-41817: Regular Expression Denial of Service Vunlerability of Date Parsing Methods" +author: "mame" +translator: +date: 2021-11-15 12:00:00 +0000 +tags: security +lang: en +--- + +Regular expression denial of service vulnerability of date parsing methods was found. An attacker can exploit this vulnerability to cause an effective denial of service. + +## Details + +Date's parsing methods including `Date.parse` are using Regexps internally, some of which are vulnerable against regular expression denial of service. Applications and libraries that apply such methods to untrusted input may be affected. + +The fix limits the input length up to 128 bytes by default instead of changing the regexps. This is because Date gem uses many Regexps and it is possible that there are still undiscovered vulnerable Regexps. For compatibility, it is allowed to remove the limitation by explicitly passing `limit` keywords as `nil` like `Date.parse(str, limit: nil)`, but note that it may take a long time to parse. + +Please update the date gem to version 3.2.1, 3.1.2, 3.0.2, and 2.0.1, or later. You can use `gem update date` to update it. If you are using bundler, please add `gem "date", ">= 3.2.1"` to your `Gemfile`. + +## Affected versions + +* date gem 2.0.0 or prior (which are bundled versions with Ruby 2.6 series) +* date gem 3.0.1 or prior (which are bundled versions with Ruby 2.7 series) +* date gem 3.1.1 or prior (which are bundled versions with Ruby 3.0 series) +* date gem 3.2.0 or prior + +## Credits + +Thanks to [svalkanov](https://hackerone.com/svalkanov) for discovering this issue. + +## History + +* Originally published at 2021-11-15 12:00:00 (UTC) From ac0344657d370cb1d7d2fad64521ebac11b87e05 Mon Sep 17 00:00:00 2001 From: "NARUSE, Yui" Date: Tue, 9 Nov 2021 18:51:11 +0900 Subject: [PATCH 0054/1090] Ruby 3.1.0 Preview 1 Released (#2726) * Ruby 3.1.0 Preview 1 Released * Apply suggestions from code review Co-authored-by: Koichi ITO Co-authored-by: Koichi ITO --- _data/branches.yml | 5 + _data/downloads.yml | 1 + _data/releases.yml | 26 +++ ...2021-11-09-ruby-3-1-0-preview1-released.md | 218 ++++++++++++++++++ 4 files changed, 250 insertions(+) create mode 100644 en/news/_posts/2021-11-09-ruby-3-1-0-preview1-released.md diff --git a/_data/branches.yml b/_data/branches.yml index 76ed04e496..ebd2220b93 100644 --- a/_data/branches.yml +++ b/_data/branches.yml @@ -8,6 +8,11 @@ # date: date of first stable release (YYYY-MM-DD) # eol_date: date of EOL (YYYY-MM-DD) +- name: 3.1 + status: preview + date: + eol_date: + - name: 3.0 status: normal maintenance date: 2020-12-25 diff --git a/_data/downloads.yml b/_data/downloads.yml index f0926cb30d..ff61bd1094 100644 --- a/_data/downloads.yml +++ b/_data/downloads.yml @@ -4,6 +4,7 @@ # optional preview: + - 3.1.0-preview1 stable: diff --git a/_data/releases.yml b/_data/releases.yml index 2a33bc205c..b9517dda24 100644 --- a/_data/releases.yml +++ b/_data/releases.yml @@ -19,6 +19,32 @@ # In order to get the release listed on the downloads page, # you also need to add an entry to `_data/downloads.yml'. +# 3.1 series + +- version: 3.1.0-preview1 + date: 2021-11-09 + post: /en/news/2021/11/09/ruby-3-1-0-preview1-released/ + url: + gz: https://cache.ruby-lang.org/pub/ruby/3.1/ruby-3.1.0-preview1.tar.gz + zip: https://cache.ruby-lang.org/pub/ruby/3.1/ruby-3.1.0-preview1.zip + xz: https://cache.ruby-lang.org/pub/ruby/3.1/ruby-3.1.0-preview1.tar.xz + size: + gz: 20821221 + zip: 25019629 + xz: 15742844 + sha1: + gz: 40dfd3db076a49fab9a0eee51e89d9b3d16a4e23 + zip: ef5fa22890e55935db4b96b3089a8aea1335bd85 + xz: 22aa861b17031cd1b163b7443f5f2f5897c5895e + sha256: + gz: 540f49f4c3aceb1a5d7fb0b8522a04dd96bc4a22f9660a6b59629886c8e010d4 + zip: 4e8d118b2365164873148ac545a8fa36c098b846a9b19ebb9037f8ee9adb4414 + xz: 86a836ad42f6a7a469fce71ffec48fd3184af55bf79e488b568a4f64adee551d + sha512: + gz: 63f528f20905827d03649ed9804e4a4e5c15078f9c6c8efcfb306baa7baafa17a406eb09a2c08b42e151e14af33b1aadbd9fb1cc84f9353d070b54bbf1ff950d + zip: 917803aac0848e00871614a09740b5c9cca26f200d68580dde61666633f1b7fee506e25ea4ed0c38eb20149417bf9f1ed449a4d2aec5b726de670e7177e5c07a + xz: bdbd7c624197ca478658280d84123a8c12ae72425bc566dcc75989c5b5ef114dd57e64efc09e2413ed615d9b47621a70ace0f3612e8ca7ba853822ad9e88c0b0 + # 3.0 series - version: 3.0.2 diff --git a/en/news/_posts/2021-11-09-ruby-3-1-0-preview1-released.md b/en/news/_posts/2021-11-09-ruby-3-1-0-preview1-released.md new file mode 100644 index 0000000000..4011a2da87 --- /dev/null +++ b/en/news/_posts/2021-11-09-ruby-3-1-0-preview1-released.md @@ -0,0 +1,218 @@ +--- +layout: news_post +title: "Ruby 3.1.0 Preview 1 Released" +author: "naruse" +translator: +date: 2021-11-09 00:00:00 +0000 +lang: en +--- + +We are pleased to announce the release of Ruby {{ release.version }}. + +{% assign release = site.data.releases | where: "version", "3.1.0-preview1" | first %} + + +## YJIT: New experimental in-process JIT compiler + + +Ruby 3.1 merges YJIT, a new in-process JIT compiler developed by Shopify. + +Since [Ruby 2.6 introduced MJIT in 2018](https://www.ruby-lang.org/en/news/2018/12/25/ruby-2-6-0-released/), its performance greatly improved, and finally [we achieved Ruby3x3 last year](https://www.ruby-lang.org/en/news/2020/12/25/ruby-3-0-0-released/). But even though Optcarrot has shown impressive speedups, the JIT hasn't benefited real world business applications. + +Recently Shopify contributed many Ruby improvements to speed up their Rails application. YJIT is an important contribution, and aims to improve the performance of Rails applications. + +Though MJIT is a method-based JIT compiler and uses an external C compiler, YJIT uses Basic Block Versioning and includes JIT compiler inside it. With Lazy Basic Block Versioning (LBBV) it first compiles the beginning of a method, and incrementally compiles the rest when the type of arguments and variables are dynamically determined. See [YJIT: a basic block versioning JIT compiler for CRuby](https://dl.acm.org/doi/10.1145/3486606.3486781) for a detailed introduction. + +With this technology, YJIT achieves both fast warmup time and performance improvements on most real-world software, up to 22% on railsbench, 39% on liquid-render. + + + +YJIT is still an experimental feature, and as such, it is disabled by default. If you want to use this, specify the `--yjit` command-line option to enable YJIT. It is also limited to macOS & Linux on x86-64 platforms for now. + +* https://bugs.ruby-lang.org/issues/18229 +* https://shopify.engineering/yjit-just-in-time-compiler-cruby +* https://www.youtube.com/watch?v=PBVLf3yfMs8 + +## debug gem: A new debugger + +A new debugger [debug.gem](https://github.com/ruby/debug) is bundled. debug.gem is fast debugger implementation and it provides many features like remote debugging, colorful REPL, IDE (VSCode) integration and more. It replaces `lib/debug.rb` standard library. + +## error_highlight: Fine-grained error location in backtrace + +A built-in gem, error_highlight, has been introduced. It includes fine-grained error location in backtrace: + +``` +$ ruby test.rb +test.rb:1:in `
': undefined method `time' for 1:Integer (NoMethodError) + +1.time {} + ^^^^^ +Did you mean? times +``` + +This gem is enabled by default. You can disable it by using a command-line option `--disable-error_highlight`. See [the repository](https://github.com/ruby/error_highlight) in detail. + +## Irb improvement + +To be described in next preview. + +## Other Notable New Features + +### Language + +* Values in Hash literals and keyword arguments can be omitted. [Feature #14579] + * `{x:, y:}` is a syntax sugar of `{x: x, y: y}`. + * `foo(x:, y:)` is a syntax sugar of `foo(x: x, y: y)`. + +* Pin operator in pattern matching now takes an expression. [Feature #17411] + +```ruby +Prime.each_cons(2).lazy.find_all{_1 in [n, ^(n + 2)]}.take(3).to_a +#=> [[3, 5], [5, 7], [11, 13]] +``` + + +### RBS + +RBS is a language to describe the structure of Ruby programs. See [the repository](https://github.com/ruby/rbs) for detail. + +Updates since Ruby 3.0.0: + +* `rbs collection` has been introduced to manage gems' RBSs. [doc](https://github.com/ruby/rbs/blob/master/docs/collection.md) +* Many signatures for built-in and standard libraries have been added/updated. +* It includes many bug fixes and performance improvements too. + +See [the CHANGELOG.md](https://github.com/ruby/rbs/blob/master/CHANGELOG.md) for more information. + +### TypeProf + +TypeProf is a static type analyzer for Ruby. It generates a prototype of RBS from non-type-annotated Ruby code. See [the document](https://github.com/ruby/typeprof/blob/master/doc/doc.md) for detail. + +Updates since Ruby 3.0.0: + +* [Experimental IDE support](https://github.com/ruby/typeprof/blob/master/doc/ide.md) has been implemented. +* Many bug fixes and performance improvements. + +## Performance improvements + +* MJIT + * For workloads like Rails, the default `--jit-max-cache` is changed from 100 to 10000. + The JIT compiler no longer skips compilation of methods longer than 1000 instructions. + * To support Zeitwerk of Rails, JIT-ed code is no longer cancelled + when a TracePoint for class events is enabled. + +## Other notable changes since 3.0 + +* One-line pattern matching, e.g., `ary => [x, y, z]`, is no longer experimental. +* Multiple assignment evaluation order has been changed slightly. [Bug #4443]] + * `foo[0], bar[0] = baz, qux` was evaluated in order `baz`, `qux`, `foo`, and then `bar` in Ruby 3.0. In Ruby 3.1, it is evaluated in order `foo`, `bar`, `baz`, and then `qux`. +* Variable Width Allocation: Strings (experimental) [[Bug #18239]](https://bugs.ruby-lang.org/issues/18239) + +### Standard libraries updates + +* Some standard libraries are updated. + * RubyGems + * Bundler + * RDoc 6.4.0 + * ReLine + * JSON 2.6.0 + * Psych 4.0.2 + * FileUtils 1.6.0 + * Fiddle + * StringIO 3.0.1 + * IO::Console 0.5.9 + * IO::Wait 0.2.0 + * CSV + * Etc 1.3.0 + * Date 3.2.0 + * Zlib 2.1.1 + * StringScanner + * IpAddr + * Logger 1.4.4 + * OStruct 0.5.0 + * Irb + * Racc 1.6.0 + * Delegate 0.2.0 + * Benchmark 0.2.0 + * CGI 0.3.0 + * Readline(C-ext) 0.1.3 + * Timeout 0.2.0 + * YAML 0.2.0 + * URI 0.11.0 + * OpenSSL + * DidYouMean + * Weakref 0.1.1 + * Tempfile 0.1.2 + * TmpDir 0.1.2 + * English 0.7.1 + * Net::Protocol 0.1.2 + * Net::Http 0.2.0 + * BigDecimal + * OptionParser 0.2.0 + * Set + * Find 0.1.1 + * Rinda 0.1.1 + * Erb + * NKF 0.1.1 + * Base64 0.1.1 + * OpenUri 0.2.0 + * SecureRandom 0.1.1 + * Resolv 0.2.1 + * Resolv::Replace 0.1.0 + * Time 0.2.0 + * PP 0.2.1 + * Prettyprint 0.1.1 + * Drb 2.1.0 + * Pathname 0.2.0 + * Digest 3.1.0.pre2 + * Un 0.2.0 +* The following bundled gems are updated. + * minitest 5.14.4 + * power_assert 2.0.1 + * rake 13.0.6 + * test-unit 3.5.0 + * rbs 1.6.2 + * typeprof 0.20.0 +* The following default gems are now bundled gems. + * net-ftp + * net-imap + * net-pop + * net-smtp + * matrix + * prime + +See [NEWS](https://github.com/ruby/ruby/blob/{{ release.tag }}/NEWS.md) +or [commit logs](https://github.com/ruby/ruby/compare/v3_0_0...{{ release.tag }}) +for more details. + +With those changes, [{{ release.stats.files_changed }} files changed, {{ release.stats.insertions }} insertions(+), {{ release.stats.deletions }} deletions(-)](https://github.com/ruby/ruby/compare/v3_0_0...{{ release.tag }}#file_bucket) +since Ruby 3.0.0! + +## Download + +* <{{ release.url.gz }}> + + SIZE: {{ release.size.gz }} + SHA1: {{ release.sha1.gz }} + SHA256: {{ release.sha256.gz }} + SHA512: {{ release.sha512.gz }} + +* <{{ release.url.xz }}> + + SIZE: {{ release.size.xz }} + SHA1: {{ release.sha1.xz }} + SHA256: {{ release.sha256.xz }} + SHA512: {{ release.sha512.xz }} + +* <{{ release.url.zip }}> + + SIZE: {{ release.size.zip }} + SHA1: {{ release.sha1.zip }} + SHA256: {{ release.sha256.zip }} + SHA512: {{ release.sha512.zip }} + +## What is Ruby + +Ruby was first developed by Matz (Yukihiro Matsumoto) in 1993, +and is now developed as Open Source. It runs on multiple platforms +and is used all over the world especially for web development. From 55cacc1594da88f81d3d2c753dbb102d67676fc3 Mon Sep 17 00:00:00 2001 From: "NARUSE, Yui" Date: Tue, 9 Nov 2021 19:15:52 +0900 Subject: [PATCH 0055/1090] fix _data/releases.yml (#2727) --- _data/releases.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/_data/releases.yml b/_data/releases.yml index b9517dda24..1495ba54d1 100644 --- a/_data/releases.yml +++ b/_data/releases.yml @@ -24,6 +24,11 @@ - version: 3.1.0-preview1 date: 2021-11-09 post: /en/news/2021/11/09/ruby-3-1-0-preview1-released/ + tag: ruby_3_1_0_preview1 + stats: + files_changed: 2963 + insertions: 529321 + deletions: 92305 url: gz: https://cache.ruby-lang.org/pub/ruby/3.1/ruby-3.1.0-preview1.tar.gz zip: https://cache.ruby-lang.org/pub/ruby/3.1/ruby-3.1.0-preview1.zip From 0e3dc53ed5ce5d2051d4ce2183b640e0e2afaf5b Mon Sep 17 00:00:00 2001 From: Andrias Meisyal Date: Sat, 6 Nov 2021 18:34:26 +0700 Subject: [PATCH 0056/1090] Fix title and link to translated posts (id) --- id/news/_posts/2021-04-05-ruby-2-5-9-released.md | 2 +- id/news/_posts/2021-04-05-ruby-2-6-7-released.md | 4 ++-- id/news/_posts/2021-04-05-ruby-2-7-3-released.md | 2 +- id/news/_posts/2021-04-05-ruby-3-0-1-released.md | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/id/news/_posts/2021-04-05-ruby-2-5-9-released.md b/id/news/_posts/2021-04-05-ruby-2-5-9-released.md index 6b2b4412da..8fa7d895df 100644 --- a/id/news/_posts/2021-04-05-ruby-2-5-9-released.md +++ b/id/news/_posts/2021-04-05-ruby-2-5-9-released.md @@ -13,7 +13,7 @@ Rilis ini mencakup beberapa perbaikan keamanan. Mohon cek topik-topik di bawah ini untuk lebih detail. * [CVE-2020-25613: Potensi Kerentanan HTTP Request Smuggling pada WEBrick]({%link id/news/_posts/2020-09-29-http-request-smuggling-cve-2020-25613.md %}) -* [CVE-2021-28965: XML round-trip vulnerability in REXML]({% link en/news/_posts/2021-04-05-xml-round-trip-vulnerability-in-rexml-cve-2021-28965.md %}) +* [CVE-2021-28965: Kerentanan XML round-trip pada REXML]({% link id/news/_posts/2021-04-05-xml-round-trip-vulnerability-in-rexml-cve-2021-28965.md %}) Lihat [commit logs](https://github.com/ruby/ruby/compare/v2_5_8...v2_5_9) untuk detail. diff --git a/id/news/_posts/2021-04-05-ruby-2-6-7-released.md b/id/news/_posts/2021-04-05-ruby-2-6-7-released.md index 9eb9e5ef3f..82a0edb22d 100644 --- a/id/news/_posts/2021-04-05-ruby-2-6-7-released.md +++ b/id/news/_posts/2021-04-05-ruby-2-6-7-released.md @@ -13,7 +13,7 @@ Rilis ini memuat perbaikan keamanan. Mohon cek topik-topik di bawah ini untuk lebih detail. * [CVE-2020-25613: Potensi Kerentanan HTTP Request Smuggling pada WEBrick]({%link id/news/_posts/2020-09-29-http-request-smuggling-cve-2020-25613.md %}) -* [CVE-2021-28965: XML round-trip vulnerability in REXML]({% link id/news/_posts/2021-04-05-xml-round-trip-vulnerability-in-rexml-cve-2021-28965.md %}) +* [CVE-2021-28965: Kerentanan XML round-trip pada REXML]({% link id/news/_posts/2021-04-05-xml-round-trip-vulnerability-in-rexml-cve-2021-28965.md %}) Lihat [commit logs](https://github.com/ruby/ruby/compare/v2_6_6...v2_6_7) untuk detail. @@ -66,4 +66,4 @@ Banyak *committer*, pengembang, dan pengguna yang telah menyediakan laporan *bug* membantu kami membuat rilis ini. Terima kasih atas kontribusinya. Perawatan Ruby 2.6, termasuk rilis ini, didasarkan pada "Agreement for the Ruby -stable version" dari Ruby Associaction. +stable version" dari Ruby Association. diff --git a/id/news/_posts/2021-04-05-ruby-2-7-3-released.md b/id/news/_posts/2021-04-05-ruby-2-7-3-released.md index 72ab593135..b8f766b376 100644 --- a/id/news/_posts/2021-04-05-ruby-2-7-3-released.md +++ b/id/news/_posts/2021-04-05-ruby-2-7-3-released.md @@ -13,7 +13,7 @@ Rilis ini mencakup perbaikan keamanan. Mohon cek topik-topik di bawah ini untuk lebih detail. * [CVE-2021-28965: Kerentanan XML round-trip pada REXML]({% link id/news/_posts/2021-04-05-xml-round-trip-vulnerability-in-rexml-cve-2021-28965.md %}) -* [CVE-2021-28966: Path traversal in Tempfile on Windows]({% link en/news/_posts/2021-04-05-tempfile-path-traversal-on-windows-cve-2021-28966.md %}) +* [CVE-2021-28966: Path traversal pada Tempfile di Windows]({% link id/news/_posts/2021-04-05-tempfile-path-traversal-on-windows-cve-2021-28966.md %}) Cek [commit logs](https://github.com/ruby/ruby/compare/v2_7_2...v2_7_3) untuk detail. diff --git a/id/news/_posts/2021-04-05-ruby-3-0-1-released.md b/id/news/_posts/2021-04-05-ruby-3-0-1-released.md index 282f9a5822..b18565ffdb 100644 --- a/id/news/_posts/2021-04-05-ruby-3-0-1-released.md +++ b/id/news/_posts/2021-04-05-ruby-3-0-1-released.md @@ -13,7 +13,7 @@ Rilis ini memuat perbaikan keamanan. Mohon cek topik-topik di bawah ini untuk lebih detail. * [CVE-2021-28965: Kerentanan XML round-trip pada REXML]({% link id/news/_posts/2021-04-05-xml-round-trip-vulnerability-in-rexml-cve-2021-28965.md %}) -* [CVE-2021-28966: Path traversal in Tempfile on Windows]({% link en/news/_posts/2021-04-05-tempfile-path-traversal-on-windows-cve-2021-28966.md %}) +* [CVE-2021-28966: Path traversal pada Tempfile di Windows]({% link id/news/_posts/2021-04-05-tempfile-path-traversal-on-windows-cve-2021-28966.md %}) Lihat [commit logs](https://github.com/ruby/ruby/compare/v3_0_0...v3_0_1) untuk detail. From c0dc4a3aaad9815263d0aea8304d9d7091336024 Mon Sep 17 00:00:00 2001 From: Peter Zhu Date: Thu, 11 Nov 2021 15:20:36 -0500 Subject: [PATCH 0057/1090] Fix tag name for Ruby 3.1.0-preview1 Links are broken in the release page because the release tag is `v3_1_0_preview1` and not `ruby_3_1_0_preview1`. --- _data/releases.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_data/releases.yml b/_data/releases.yml index 1495ba54d1..15878152b8 100644 --- a/_data/releases.yml +++ b/_data/releases.yml @@ -24,7 +24,7 @@ - version: 3.1.0-preview1 date: 2021-11-09 post: /en/news/2021/11/09/ruby-3-1-0-preview1-released/ - tag: ruby_3_1_0_preview1 + tag: v3_1_0_preview1 stats: files_changed: 2963 insertions: 529321 From 2ce5cd6c8a72592c8e36340ced264ed66e9acc3b Mon Sep 17 00:00:00 2001 From: vurtn Date: Thu, 11 Nov 2021 21:28:10 +0100 Subject: [PATCH 0058/1090] translation of ruby 3.1.0 preview1 (fr) --- ...2021-11-09-ruby-3-1-0-preview1-released.md | 215 ++++++++++++++++++ 1 file changed, 215 insertions(+) create mode 100644 fr/news/_posts/2021-11-09-ruby-3-1-0-preview1-released.md diff --git a/fr/news/_posts/2021-11-09-ruby-3-1-0-preview1-released.md b/fr/news/_posts/2021-11-09-ruby-3-1-0-preview1-released.md new file mode 100644 index 0000000000..d80e6c8737 --- /dev/null +++ b/fr/news/_posts/2021-11-09-ruby-3-1-0-preview1-released.md @@ -0,0 +1,215 @@ +--- +layout: news_post +title: "Ruby 3.1.0 Preview 1 est disponible" +author: "naruse" +translator: "Kevin Rosaz" +date: 2021-11-09 00:00:00 +0000 +lang: fr +--- +{% assign release = site.data.releases | where: "version", "3.1.0-preview1" | first %} + +Nous avons le plaisir de vous annoncer la sortie de Ruby {{ release.version }}. + + +## YJIT: un nouveau compilateur JIT en cours de développement + + +Ruby 3.1 fusionne YJIT, un nouveau compilateur JIT développé par Shopify. + +Depuis que [Ruby 2.6 a introduit MJIT en 2018](https://www.ruby-lang.org/en/news/2018/12/25/ruby-2-6-0-released/), ses performances se sont grandement améliorées et [nous sommes parvenus à Ruby3x3 l'année dernière](https://www.ruby-lang.org/fr/news/2020/12/25/ruby-3-0-0-released/). Même si Optcarrot a montré des accélérations impressionnantes, le JIT n'a pas profité aux applications du monde professionnel. + +Récemment, Shopify a apporté de nombreuses améliorations à Ruby pour accélérer son application Rails. YJIT est une contribution importante et vise à améliorer les performances des applications Rails. + +Bien que MJIT soit un compilateur JIT basé sur des méthodes et qu'il utilise un compilateur C externe, YJIT utilise le Basic Block Versioning et inclut le compilateur JIT à l'intérieur. Avec Lazy Basic Block Versioning (LBBV), cela compile d'abord le début d'une méthode et compile progressivement le reste lorsque le type des arguments et des variables est déterminé dynamiquement. Voir [YJIT: a basic block versioning JIT compiler for CRuby](https://dl.acm.org/doi/10.1145/3486606.3486781) pour une introduction détaillée. + +Avec cette technologie, YJIT permet d'avoir à la fois un temps de démarrage rapide et des améliorations de performance sur la plupart des logiciels, jusqu'à 22% sur railsbench et 39% sur le rendu liquid. + + + +YJIT est toujours une fonctionnalité expérimentale. En tant que telle, elle est désactivée par défaut. Si vous souhaitez l'utiliser, spécifiez l'option en ligne de commande `--yjit` pour activer YJIT. L'utilisation est pour le moment limitée à macOS et Linux sur les plateformes x86-64. + +* https://bugs.ruby-lang.org/issues/18229 +* https://shopify.engineering/yjit-just-in-time-compiler-cruby +* https://www.youtube.com/watch?v=PBVLf3yfMs8 + +## debug gem: un nouveau débogueur + +Un nouveau débogueur [debug.gem](https://github.com/ruby/debug) est inclu. debug.gem est une implémentation rapide du débogueur et fournit de nombreuses fonctionnalités telles que le débogage à distance, un REPL coloré, une intégration dans un IDE (VSCode) et bien plus encore. Cela remplace `lib/debug.rb` de la bibliothèque standard. + +## error_highlight: localisation des erreurs plus précise + +La gemme error_highlight a été ajoutée. Elle permet d'obtenir la localisation d'une erreur de manière plus précise dans la trace : + +``` +$ ruby test.rb +test.rb:1:in `
': undefined method `time' for 1:Integer (NoMethodError) + +1.time {} + ^^^^^ +Did you mean? times +``` + +Cette gemme est activée par défaut. Vous pouvez la désactiver en utilisant l'option en ligne de commande `--disable-error_highlight`. Voir [le dépôt](https://github.com/ruby/error_highlight) pour de plus amples informations. + +## Amélioration d'IRB + +À décrire dans le prochain aperçu. + +## Autres nouvelles fonctionnalités notables + +### Language + +* Les valeurs dans les littéraux de hachage peuvent être omis. [Feature #14579] + * `{x:, y:}` est un sucre syntaxique de `{x: x, y: y}`. + * `foo(x:, y:)` est un sucre syntaxique de `foo(x: x, y: y)`. + +* L'opérateur pin dans le filtrage par motif prend désormais une expression. [Feature #17411] + +```ruby +Prime.each_cons(2).lazy.find_all{_1 in [n, ^(n + 2)]}.take(3).to_a +#=> [[3, 5], [5, 7], [11, 13]] +``` + + +### RBS + +RBS est un langage pour décrire la structure des programmes Ruby. Voir [le dépôt](https://github.com/ruby/rbs) pour de plus amples informations. + +Mises à jour depuis Ruby 3.0.0: + +* `rbs collection` a été introduite pour gérer les RBS des gemmes. [doc](https://github.com/ruby/rbs/blob/master/docs/collection.md) +* Plusieurs signatures pour des bibliothèques intégrées et standards ont été ajoutées/mises à jour. +* Il y a également de nombreuses corrections de bogues et d'améliorations de performance. + +Voir [le CHANGELOG.md](https://github.com/ruby/rbs/blob/master/CHANGELOG.md) pour de plus amples informations. + +### TypeProf + +TypeProf est un analyseur de type statique pour Ruby. Il génère un prototype de RBS à partir de code Ruby non annoté de type. Voir [le document](https://github.com/ruby/typeprof/blob/master/doc/doc.md) pour de plus amples informations. + +Mises à jour depuis Ruby 3.0.0 : + +* [Le support expérimental pour IDE](https://github.com/ruby/typeprof/blob/master/doc/ide.md) a été implémenté. +* Il y a également de nombreuses corrections de bogues et d'améliorations de performance. + +## Amélioration de performance + +* MJIT + * Pour les charges de travail telles que Rails, la valeur par défaut `--jit-max-cache` passe de 100 à 10000. + Le compilateur JIT ne saute plus la compilation des méthodes de plus de 1000 instructions. + * Pour prendre en charge Zeitwerk de Rails, le code généré par le compilateur JIT n'est plus annulé + lorsqu'un TracePoint est activé pour les évènements de classe. + +## Autres changements notables depuis la version 3.0 + +* Le filtrage par motif en une ligne, e.g., `ary => [x, y, z]`, n'est plus au stade expérimental. +* L'ordre d'évaluation des affectations multiples a été légèrement modifié. [[Bug #4443]](https://bugs.ruby-lang.org/issues/4443) + * `foo[0], bar[0] = baz, qux` était évalué dans l'ordre `baz`, `qux`, `foo` puis `bar` dans Ruby 3.0. Dans Ruby 3.1, l'évaluation est dans l'ordre `foo`, `bar`, `baz` puis `qux`. +* Allocation de la taille d'une variable: Strings (expérimental) [[Bug #18239]](https://bugs.ruby-lang.org/issues/18239) + +### Mises à jour des bibliothèques standards + +* Plusieurs bibliothèques standards ont été mises à jour. + * RubyGems + * Bundler + * RDoc 6.4.0 + * ReLine + * JSON 2.6.0 + * Psych 4.0.2 + * FileUtils 1.6.0 + * Fiddle + * StringIO 3.0.1 + * IO::Console 0.5.9 + * IO::Wait 0.2.0 + * CSV + * Etc 1.3.0 + * Date 3.2.0 + * Zlib 2.1.1 + * StringScanner + * IpAddr + * Logger 1.4.4 + * OStruct 0.5.0 + * Irb + * Racc 1.6.0 + * Delegate 0.2.0 + * Benchmark 0.2.0 + * CGI 0.3.0 + * Readline(C-ext) 0.1.3 + * Timeout 0.2.0 + * YAML 0.2.0 + * URI 0.11.0 + * OpenSSL + * DidYouMean + * Weakref 0.1.1 + * Tempfile 0.1.2 + * TmpDir 0.1.2 + * English 0.7.1 + * Net::Protocol 0.1.2 + * Net::Http 0.2.0 + * BigDecimal + * OptionParser 0.2.0 + * Set + * Find 0.1.1 + * Rinda 0.1.1 + * Erb + * NKF 0.1.1 + * Base64 0.1.1 + * OpenUri 0.2.0 + * SecureRandom 0.1.1 + * Resolv 0.2.1 + * Resolv::Replace 0.1.0 + * Time 0.2.0 + * PP 0.2.1 + * Prettyprint 0.1.1 + * Drb 2.1.0 + * Pathname 0.2.0 + * Digest 3.1.0.pre2 + * Un 0.2.0 +* Les gemmes incluses suivantes ont été mises à jour. + * minitest 5.14.4 + * power_assert 2.0.1 + * rake 13.0.6 + * test-unit 3.5.0 + * rbs 1.6.2 + * typeprof 0.20.0 +* Les gemmes par défaut suivantes sont désormais incluses. + * net-ftp + * net-imap + * net-pop + * net-smtp + * matrix + * prime + +Voir [NEWS](https://github.com/ruby/ruby/blob/{{ release.tag }}/NEWS.md) +ou les [logs de commit](https://github.com/ruby/ruby/compare/v3_0_0...{{ release.tag }}) +pour de plus amples informations. + +Avec ces changements, [{{ release.stats.files_changed }} fichiers changés, {{ release.stats.insertions }} insertions(+), {{ release.stats.deletions }} suppressions(-)](https://github.com/ruby/ruby/compare/v3_0_0...{{ release.tag }}#file_bucket) +depuis Ruby 3.0.0! + +## Téléchargement + +* <{{ release.url.gz }}> + + SIZE: {{ release.size.gz }} + SHA1: {{ release.sha1.gz }} + SHA256: {{ release.sha256.gz }} + SHA512: {{ release.sha512.gz }} + +* <{{ release.url.xz }}> + + SIZE: {{ release.size.xz }} + SHA1: {{ release.sha1.xz }} + SHA256: {{ release.sha256.xz }} + SHA512: {{ release.sha512.xz }} + +* <{{ release.url.zip }}> + + SIZE: {{ release.size.zip }} + SHA1: {{ release.sha1.zip }} + SHA256: {{ release.sha256.zip }} + SHA512: {{ release.sha512.zip }} + +## Ruby, c'est quoi ? + +Ruby a été initialement développé par Matz (Yukihiro Matsumoto) en 1993 puis est devenu open source. Il fonctionne sur de nombreuses plateformes et est utilisé partout dans le monde, en particulier pour le développement web. From d4d072d9f9afce6ab4018ceaab0f4b6a05eb2562 Mon Sep 17 00:00:00 2001 From: vurtn Date: Thu, 11 Nov 2021 21:33:28 +0100 Subject: [PATCH 0059/1090] Add link to bug#4443 --- en/news/_posts/2021-11-09-ruby-3-1-0-preview1-released.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/en/news/_posts/2021-11-09-ruby-3-1-0-preview1-released.md b/en/news/_posts/2021-11-09-ruby-3-1-0-preview1-released.md index 4011a2da87..7904833062 100644 --- a/en/news/_posts/2021-11-09-ruby-3-1-0-preview1-released.md +++ b/en/news/_posts/2021-11-09-ruby-3-1-0-preview1-released.md @@ -104,7 +104,7 @@ Updates since Ruby 3.0.0: ## Other notable changes since 3.0 * One-line pattern matching, e.g., `ary => [x, y, z]`, is no longer experimental. -* Multiple assignment evaluation order has been changed slightly. [Bug #4443]] +* Multiple assignment evaluation order has been changed slightly. [[Bug #4443]](https://bugs.ruby-lang.org/issues/4443) * `foo[0], bar[0] = baz, qux` was evaluated in order `baz`, `qux`, `foo`, and then `bar` in Ruby 3.0. In Ruby 3.1, it is evaluated in order `foo`, `bar`, `baz`, and then `qux`. * Variable Width Allocation: Strings (experimental) [[Bug #18239]](https://bugs.ruby-lang.org/issues/18239) From 4ba077e10411c2a2a1daa5f34c832012bf21d19a Mon Sep 17 00:00:00 2001 From: Jacob Herrington Date: Fri, 12 Nov 2021 18:22:26 +0000 Subject: [PATCH 0060/1090] Add Remote Ruby podcasts After 154 episodes released, I think it is safe to include Remote Ruby in this list. There is a ton of great Ruby-based content being created on the podcast and they were even included in the podcast panel at RubyConf 2021. --- en/community/podcasts/index.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/en/community/podcasts/index.md b/en/community/podcasts/index.md index ae67b44f8c..0f533be95b 100644 --- a/en/community/podcasts/index.md +++ b/en/community/podcasts/index.md @@ -14,6 +14,10 @@ Listen to news, interviews, and discussions about Ruby and its community. : The Ruby on Rails Podcast, a weekly conversation about Ruby on Rails, open source software, and the programming profession. +[Remote Ruby][remote_ruby] +: Virtual meetup turned podcast, Remote Ruby celebrates and highlights + the Ruby community in an informal setting. + ### Getting Involved Podcast hosts are always looking for guests. If you have some Ruby @@ -21,5 +25,6 @@ wisdom to share, get in touch with the creators of these shows. You can also start your own Ruby podcast and get added to this list! +[remote_ruby]: https://remoteruby.transistor.fm/ [rorpodcast]: http://5by5.tv/rubyonrails [rogues]: https://devchat.tv/ruby-rogues From 4828a3839ad6e008884c2832efced9c1032beef7 Mon Sep 17 00:00:00 2001 From: Yusuke Endoh Date: Mon, 15 Nov 2021 15:35:11 +0900 Subject: [PATCH 0061/1090] Fix the URL to the bug founder --- .../2021-11-15-date-parsing-method-regexp-dos-cve-2021-41817.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/en/news/_posts/2021-11-15-date-parsing-method-regexp-dos-cve-2021-41817.md b/en/news/_posts/2021-11-15-date-parsing-method-regexp-dos-cve-2021-41817.md index 6918d96ff1..68210bd080 100644 --- a/en/news/_posts/2021-11-15-date-parsing-method-regexp-dos-cve-2021-41817.md +++ b/en/news/_posts/2021-11-15-date-parsing-method-regexp-dos-cve-2021-41817.md @@ -27,7 +27,7 @@ Please update the date gem to version 3.2.1, 3.1.2, 3.0.2, and 2.0.1, or later. ## Credits -Thanks to [svalkanov](https://hackerone.com/svalkanov) for discovering this issue. +Thanks to [svalkanov](https://github.com/SValkanov/) for discovering this issue. ## History From 10676a0103540b93b4cf4d0fb6108da54156e226 Mon Sep 17 00:00:00 2001 From: Yusuke Endoh Date: Mon, 15 Nov 2021 17:28:29 +0900 Subject: [PATCH 0062/1090] Update the release time --- ...021-11-15-date-parsing-method-regexp-dos-cve-2021-41817.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/en/news/_posts/2021-11-15-date-parsing-method-regexp-dos-cve-2021-41817.md b/en/news/_posts/2021-11-15-date-parsing-method-regexp-dos-cve-2021-41817.md index 68210bd080..c60ae5f22b 100644 --- a/en/news/_posts/2021-11-15-date-parsing-method-regexp-dos-cve-2021-41817.md +++ b/en/news/_posts/2021-11-15-date-parsing-method-regexp-dos-cve-2021-41817.md @@ -3,7 +3,7 @@ layout: news_post title: "CVE-2021-41817: Regular Expression Denial of Service Vunlerability of Date Parsing Methods" author: "mame" translator: -date: 2021-11-15 12:00:00 +0000 +date: 2021-11-15 08:00:00 +0000 tags: security lang: en --- @@ -31,4 +31,4 @@ Thanks to [svalkanov](https://github.com/SValkanov/) for discovering this issue. ## History -* Originally published at 2021-11-15 12:00:00 (UTC) +* Originally published at 2021-11-15 08:00:00 (UTC) From b4785b44bb64686b56ee995243322b080ffcb491 Mon Sep 17 00:00:00 2001 From: Yusuke Endoh Date: Mon, 15 Nov 2021 17:35:03 +0900 Subject: [PATCH 0063/1090] Improve English Co-authored-by: Sorah Fukumori --- .../2021-11-15-date-parsing-method-regexp-dos-cve-2021-41817.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/en/news/_posts/2021-11-15-date-parsing-method-regexp-dos-cve-2021-41817.md b/en/news/_posts/2021-11-15-date-parsing-method-regexp-dos-cve-2021-41817.md index c60ae5f22b..69ff12a426 100644 --- a/en/news/_posts/2021-11-15-date-parsing-method-regexp-dos-cve-2021-41817.md +++ b/en/news/_posts/2021-11-15-date-parsing-method-regexp-dos-cve-2021-41817.md @@ -8,7 +8,7 @@ tags: security lang: en --- -Regular expression denial of service vulnerability of date parsing methods was found. An attacker can exploit this vulnerability to cause an effective denial of service. +We have released date gem version 3.2.1, 3.1.2, 3.0.2, and 2.0.1 that include a security fix for a regular expression denial of service vulnerability (ReDoS) on date parsing methods. An attacker can exploit this vulnerability to cause an effective DoS attack. ## Details From 3ccb7c53d187fd0a6bbf6106f15dd174dd65c01d Mon Sep 17 00:00:00 2001 From: "Joseph D. Cohen" Date: Mon, 15 Nov 2021 06:10:31 -0800 Subject: [PATCH 0064/1090] Update 2021-11-15-date-parsing-method-regexp-dos-cve-2021-41817.md Fix typo in headline --- .../2021-11-15-date-parsing-method-regexp-dos-cve-2021-41817.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/en/news/_posts/2021-11-15-date-parsing-method-regexp-dos-cve-2021-41817.md b/en/news/_posts/2021-11-15-date-parsing-method-regexp-dos-cve-2021-41817.md index 69ff12a426..9306b21675 100644 --- a/en/news/_posts/2021-11-15-date-parsing-method-regexp-dos-cve-2021-41817.md +++ b/en/news/_posts/2021-11-15-date-parsing-method-regexp-dos-cve-2021-41817.md @@ -1,6 +1,6 @@ --- layout: news_post -title: "CVE-2021-41817: Regular Expression Denial of Service Vunlerability of Date Parsing Methods" +title: "CVE-2021-41817: Regular Expression Denial of Service Vulnerability of Date Parsing Methods" author: "mame" translator: date: 2021-11-15 08:00:00 +0000 From d5843f78080620394364f9f58d20290a249fd162 Mon Sep 17 00:00:00 2001 From: Hiroshi SHIBATA Date: Tue, 16 Nov 2021 13:29:32 +0900 Subject: [PATCH 0065/1090] Fixes #2151 --- _data/locales/ja.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/_data/locales/ja.yml b/_data/locales/ja.yml index d671aa0878..54543eef87 100644 --- a/_data/locales/ja.yml +++ b/_data/locales/ja.yml @@ -65,10 +65,10 @@ sidebar: text: 日本Rubyの会 url: http://ruby-no-kai.org/ description: Rubyの利用者/開発者の支援を目的としたグループです。 - weblogs: - text: 更新順リンク - url: http://www.rubyist.net/~kazu/samidare/ - description: Ruby関連のサイトのリンクを更新順に並べたものです。 + # weblogs: + # text: 更新順リンク + # url: http://www.rubyist.net/~kazu/samidare/ + # description: Ruby関連のサイトのリンクを更新順に並べたものです。 # ruby_core: # text: Ruby Core # url: /ja/community/ruby-core/ From fca1542763449250261863927fe1e455e7ca63c1 Mon Sep 17 00:00:00 2001 From: ytjmt <46666464+ytjmt@users.noreply.github.com> Date: Wed, 17 Nov 2021 00:21:45 +0900 Subject: [PATCH 0066/1090] Translate "CVE-2021-41817: Regular Expression Denial of Service Vulnerability of Date Parsing Methods" (ja) --- ...arsing-method-regexp-dos-cve-2021-41817.md | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 ja/news/_posts/2021-11-15-date-parsing-method-regexp-dos-cve-2021-41817.md diff --git a/ja/news/_posts/2021-11-15-date-parsing-method-regexp-dos-cve-2021-41817.md b/ja/news/_posts/2021-11-15-date-parsing-method-regexp-dos-cve-2021-41817.md new file mode 100644 index 0000000000..87f5fd3cfa --- /dev/null +++ b/ja/news/_posts/2021-11-15-date-parsing-method-regexp-dos-cve-2021-41817.md @@ -0,0 +1,34 @@ +--- +layout: news_post +title: "CVE-2021-41817: 日付をパースするメソッドにおける正規表現 Denial of Service の脆弱性について" +author: "mame" +translator: "ytjmt" +date: 2021-11-15 08:00:00 +0000 +tags: security +lang: ja +--- + +日付をパースするメソッドにおける正規表現 Denial of Service(ReDoS)脆弱性の修正を含む、date gem 3.2.1、3.1.2、3.0.2、2.0.1 をリリースしました。攻撃者はこの脆弱性を悪用し、効果的な DoS 攻撃を引き起こすことができます。 + +## 詳細 + +`Date.parse` を含む、日付をパースするメソッドの内部では正規表現を利用しており、これらには ReDoS 攻撃に対して脆弱なものがあります。信頼できない入力値に対してこれらのメソッドを適用しているアプリケーションおよびライブラリはこの脆弱性の影響を受ける可能性があります。 + +この修正では、正規表現を変更するのではなく、入力値をデフォルトで 128 バイトまでに制限するようにしています。date gem は多くの正規表現を利用しており、脆弱性のある正規表現が他にも潜んでいる可能性があるためです。互換性のため、`Date.parse(str, limit: nil)` のように、`limit` に `nil` を明示的に渡すことでこの制限を除外することができますが、パースに時間がかかる可能性があることに留意してください。 + +date gem を 3.2.1、3.1.2、3.0.2、2.0.1 かそれ以降のバージョンにアップデートしてください。`gem update date` でアップデートできます。もし bundler を使っている場合は、`Gemfile` に `gem "date", ">= 3.2.1"` を追加してください。 + +## 影響を受けるバージョン + +* date gem 2.0.0 およびそれ以前のバージョン(Ruby 2.6 系列にバンドルされているバージョン) +* date gem 3.0.1 およびそれ以前のバージョン(Ruby 2.7 系列にバンドルされているバージョン) +* date gem 3.1.1 およびそれ以前のバージョン(Ruby 3.0 系列にバンドルされているバージョン) +* date gem 3.2.0 およびそれ以前のバージョン + +## クレジット + +この脆弱性情報は、[svalkanov](https://github.com/SValkanov/) 氏によって報告されました。 + +## 更新履歴 + +* 2021-11-15 17:00:00 (JST) 初版 From e873b532af40e4aee365e897d2b0137a5d68fb34 Mon Sep 17 00:00:00 2001 From: Alexander Ilyin Date: Thu, 18 Nov 2021 14:04:20 +0300 Subject: [PATCH 0067/1090] Update link to es/community/ruby-core (es) (#2724) The following issue is completely resolved with #2708. close #2530 --- _data/locales/es.yml | 4 ++-- es/community/index.md | 2 +- es/community/ruby-core/writing-patches/index.md | 5 ++++- es/downloads/index.md | 2 +- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/_data/locales/es.yml b/_data/locales/es.yml index e193c328f9..78e3defea1 100644 --- a/_data/locales/es.yml +++ b/_data/locales/es.yml @@ -67,8 +67,8 @@ sidebar: url: /en/community/weblogs/ description: Entérate de lo que está sucediendo en la comunidad. ruby_core: - text: Ruby Core (en inglés) - url: /en/community/ruby-core/ + text: Ruby Core + url: /es/community/ruby-core/ description: Ayuda a mejorar el futuro de Ruby. issue_tracking: text: Reportes de errores diff --git a/es/community/index.md b/es/community/index.md index 6519d5a42a..f7ddb68944 100644 --- a/es/community/index.md +++ b/es/community/index.md @@ -29,7 +29,7 @@ donde empezar: : El canal IRC The Ruby Language es un buen lugar para chatear con otros compañeros Rubyistas. -[El Core de Ruby](/en/community/ruby-core/) (en inglés) +[El Core de Ruby](/es/community/ruby-core/) : Con Ruby 2.0 en camino, ahora es un buen momento para seguir cómo va su desarrollo. Si estás interesado en ayudar con Ruby, comienza por aquí. diff --git a/es/community/ruby-core/writing-patches/index.md b/es/community/ruby-core/writing-patches/index.md index 4652a7aa21..e25b2acdd6 100644 --- a/es/community/ruby-core/writing-patches/index.md +++ b/es/community/ruby-core/writing-patches/index.md @@ -42,6 +42,9 @@ en la lista de distribución de Ruby-Core: Un parche que proporciona casos de prueba (preferiblemente un parche para `test/*/test_*.rb`) nos ayudaría a comprender el parche y su intención. -Podríamos pasar a un flujo de trabajo push/pull estilo Git en el futuro.. +Podríamos pasar a un flujo de trabajo push/pull estilo Git en el futuro. Pero hasta entonces, seguir las pautas anteriores te ayudaría a evitar una frustración. + + +[ruby-core-post]: http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-core/25139 diff --git a/es/downloads/index.md b/es/downloads/index.md index 80eec23e09..f5fdf3886a 100644 --- a/es/downloads/index.md +++ b/es/downloads/index.md @@ -63,7 +63,7 @@ antes mencionadas. Pueden servirte de ayuda. Puede contener errores, ¡úsalo bajo tu responsabilidad! Para información sobre los repositorios de Subversion y Git, consulta -nuestra página [Ruby core](/en/community/ruby-core/) (en inglés). +nuestra página [Ruby Core](/es/community/ruby-core/). El código fuente de Ruby está disponible desde un conjunto de [sitios espejo][mirrors] a lo largo del mundo. From d68292788396b07e3bc124d1f7a8a253c2ce835e Mon Sep 17 00:00:00 2001 From: Hiroshi SHIBATA Date: Wed, 24 Nov 2021 10:26:32 +0900 Subject: [PATCH 0068/1090] update bundles --- Gemfile.lock | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index ebfc7e5301..a1468eaa52 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -6,14 +6,14 @@ GEM colorator (1.1.0) concurrent-ruby (1.1.9) crass (1.0.6) - em-websocket (0.5.2) + em-websocket (0.5.3) eventmachine (>= 0.12.9) - http_parser.rb (~> 0.6.0) + http_parser.rb (~> 0) eventmachine (1.2.7) ffi (1.15.4) forwardable-extended (2.6.0) - http_parser.rb (0.6.0) - i18n (1.8.10) + http_parser.rb (0.8.0) + i18n (1.8.11) concurrent-ruby (~> 1.0) jekyll (4.2.1) addressable (~> 2.4) @@ -122,4 +122,4 @@ RUBY VERSION ruby 3.0.2p107 BUNDLED WITH - 2.2.27 + 2.2.31 From 70f838f342d14b61c1b44b79c946594de485d053 Mon Sep 17 00:00:00 2001 From: Yusuke Endoh Date: Tue, 16 Nov 2021 17:48:36 +0900 Subject: [PATCH 0069/1090] Add draft release announcements Two CVEs about cgi gem are included CVE-2021-41816: Buffer Overrun in CGI.escape_html CVE-2021-41819: Cookie Prefix Spoofing in CGI::Cookie.parse --- ...errun-in-cgi-escape_html-cve-2021-41816.md | 36 +++++++++++ ...fing-in-cgi-cookie-parse-cve-2021-41819.md | 47 +++++++++++++++ .../_posts/2021-11-24-ruby-2-6-9-released.md | 59 +++++++++++++++++++ .../_posts/2021-11-24-ruby-2-7-5-released.md | 58 ++++++++++++++++++ .../_posts/2021-11-24-ruby-3-0-3-released.md | 49 +++++++++++++++ 5 files changed, 249 insertions(+) create mode 100644 en/news/_posts/2021-11-24-buffer-overrun-in-cgi-escape_html-cve-2021-41816.md create mode 100644 en/news/_posts/2021-11-24-cookie-prefix-spoofing-in-cgi-cookie-parse-cve-2021-41819.md create mode 100644 en/news/_posts/2021-11-24-ruby-2-6-9-released.md create mode 100644 en/news/_posts/2021-11-24-ruby-2-7-5-released.md create mode 100644 en/news/_posts/2021-11-24-ruby-3-0-3-released.md diff --git a/en/news/_posts/2021-11-24-buffer-overrun-in-cgi-escape_html-cve-2021-41816.md b/en/news/_posts/2021-11-24-buffer-overrun-in-cgi-escape_html-cve-2021-41816.md new file mode 100644 index 0000000000..295402c7bb --- /dev/null +++ b/en/news/_posts/2021-11-24-buffer-overrun-in-cgi-escape_html-cve-2021-41816.md @@ -0,0 +1,36 @@ +--- +layout: news_post +title: "CVE-2021-41816: Buffer Overrun in CGI.escape_html +author: "mame" +translator: +date: 2021-11-24 12:00:00 +0000 +tags: security +lang: en +--- + +A buffer overrun vulnerability was discovered in CGI.escape_html. +This vulnerability has been assigned the CVE identifier [CVE-2021-41816](https://nvd.nist.gov/vuln/detail/CVE-2021-41816). +We strongly recommend upgrading Ruby. + +## Details + +A security vulnerability that causes buffer overflow when you pass a very large string (> 700 MB) to `CGI.escape_html` on a platform where `long` type takes 4 bytes, typically, Windows. + +Please update the cgi gem to version 0.3.1, 0.2,1, and 0.1,1 or later. You can use `gem update cgi` to update it. If you are using bundler, please add `gem "cgi", ">= 0.3.1"` to your `Gemfile`. +Alternatively, please update Ruby to 2.7.5 or 3.0.3. + +This issue has been introduced since Ruby 2.7, so the cgi version bundled with Ruby 2.6 is not vulnerable. + +## Affected versions + +* cgi gem 0.1.0 or prior (which are bundled versions with Ruby 2.7 series) +* cgi gem 0.2.0 or prior (which are bundled versions with Ruby 3.0 series) +* cgi gem 0.3.0 or prior + +## Credits + +Thanks to [chamal](https://hackerone.com/chamal) for discovering this issue. + +## History + +* Originally published at 2021-11-24 12:00:00 (UTC) diff --git a/en/news/_posts/2021-11-24-cookie-prefix-spoofing-in-cgi-cookie-parse-cve-2021-41819.md b/en/news/_posts/2021-11-24-cookie-prefix-spoofing-in-cgi-cookie-parse-cve-2021-41819.md new file mode 100644 index 0000000000..819535495c --- /dev/null +++ b/en/news/_posts/2021-11-24-cookie-prefix-spoofing-in-cgi-cookie-parse-cve-2021-41819.md @@ -0,0 +1,47 @@ +--- +layout: news_post +title: "CVE-2021-41819: Cookie Prefix Spoofing in CGI::Cookie.parse" +author: "mame" +translator: +date: 2021-11-24 12:00:00 +0000 +tags: security +lang: en +--- + +A cookie prefix spoofing vulnerability was discovered in CGI::Cookie.parse. +This vulnerability has been assigned the CVE identifier [CVE-2021-41819](https://nvd.nist.gov/vuln/detail/CVE-2021-41819). +We strongly recommend upgrading Ruby. + +## Details + +The old versions of `CGI::Cookie.parse` applied URL decoding to cookie names. +An attacker could exploit this vulnerability to spoof security prefixes in cookie names, which may be able to trick a vulnerable application. + +By this fix, `CGI::Cookie.parse` no longer decodes cookie names. +Note that this is an incompatibility if cookie names that you are using include non-alphanumeric characters that are URL-encoded. + +This is the same issue of [CVE-2020-8184](https://nvd.nist.gov/vuln/detail/CVE-2020-8184). + +If you are using Ruby 2.7 or 3.0: + +* Please update the cgi gem to version 0.3.1, 0.2,1, and 0.1,1 or later. You can use `gem update cgi` to update it. If you are using bundler, please add `gem "cgi", ">= 0.3.1"` to your `Gemfile`. +* Alternatively, please update Ruby to 2.7.5 or 3.0.3. + +If you are using Ruby 2.6: + +* Please update Ruby to 2.6.9. *You cannot use `gem update cgi` for Ruby 2.6 or prior.* + +## Affected versions + +* ruby 2.6.8 or prior (You can *not* use `gem update cgi` for this version.) +* cgi gem 0.1.0 or prior (which are bundled versions with Ruby 2.7 series) +* cgi gem 0.2.0 or prior (which are bundled versions with Ruby 3.0 series) +* cgi gem 0.3.0 or prior + +## Credits + +Thanks to [ooooooo_q](https://hackerone.com/ooooooo_q) for discovering this issue. + +## History + +* Originally published at 2021-11-24 12:00:00 (UTC) diff --git a/en/news/_posts/2021-11-24-ruby-2-6-9-released.md b/en/news/_posts/2021-11-24-ruby-2-6-9-released.md new file mode 100644 index 0000000000..c77b23e7ed --- /dev/null +++ b/en/news/_posts/2021-11-24-ruby-2-6-9-released.md @@ -0,0 +1,59 @@ +--- +layout: news_post +title: "Ruby 2.6.9 Released" +author: "usa" +translator: +date: 2021-11-24 12:00:00 +0000 +lang: en +--- + +Ruby 2.6.9 has been released. + +This release includes security fixes. +Please check the topics below for details. + +* [CVE-2021-41817: Regular Expression Denial of Service Vulnerability of Date Parsing Methods]({%link 2021-11-15-date-parsing-method-regexp-dos-cve-2021-41817.md %}) +* [CVE-2021-41819: Cookie Prefix Spoofing in CGI::Cookie.parse]({%link 2021-11-24-cookie-prefix-spoofing-in-cgi-cookie-parse-cve-2021-41819.md %}) + +See the [commit logs](https://github.com/ruby/ruby/compare/v2_6_8...v2_6_9) for details. + +Ruby 2.6 is now under the state of the security maintenance phase, until the end of March of 2022. +After that date, maintenance of Ruby 2.6 will be ended. +We recommend you start planning the migration to newer versions of Ruby, such as 3.0 or 2.7. + +## Download + +{% assign release = site.data.releases | where: "version", "2.6.9" | first %} + +* <{{ release.url.bz2 }}> + + SIZE: {{ release.size.bz2 }} + SHA1: {{ release.sha1.bz2 }} + SHA256: {{ release.sha256.bz2 }} + SHA512: {{ release.sha512.bz2 }} + +* <{{ release.url.gz }}> + + SIZE: {{ release.size.gz }} + SHA1: {{ release.sha1.gz }} + SHA256: {{ release.sha256.gz }} + SHA512: {{ release.sha512.gz }} + +* <{{ release.url.xz }}> + + SIZE: {{ release.size.xz }} + SHA1: {{ release.sha1.xz }} + SHA256: {{ release.sha256.xz }} + SHA512: {{ release.sha512.xz }} + +* <{{ release.url.zip }}> + + SIZE: {{ release.size.zip }} + SHA1: {{ release.sha1.zip }} + SHA256: {{ release.sha256.zip }} + SHA512: {{ release.sha512.zip }} + +## Release Comment + +Many committers, developers, and users who provided bug reports helped us make this release. +Thanks for their contributions. diff --git a/en/news/_posts/2021-11-24-ruby-2-7-5-released.md b/en/news/_posts/2021-11-24-ruby-2-7-5-released.md new file mode 100644 index 0000000000..f1ec0cfee1 --- /dev/null +++ b/en/news/_posts/2021-11-24-ruby-2-7-5-released.md @@ -0,0 +1,58 @@ +--- +layout: news_post +title: "Ruby 2.7.5 Released" +author: "usa" +translator: +date: 2021-11-24 12:00:00 +0000 +lang: en +--- + +Ruby 2.7.5 has been released. + +This release includes security fixes. +Please check the topics below for details. + +* [CVE-2021-41817: Regular Expression Denial of Service Vulnerability of Date Parsing Methods]({%link 2021-11-15-date-parsing-method-regexp-dos-cve-2021-41817.md %}) +* [CVE-2021-41816: Buffer Overrun in CGI.escape_html]({%link 2021-11-24-buffer-overrun-in-cgi-escape_html-cve-2021-41816.md %}) +* [CVE-2021-41819: Cookie Prefix Spoofing in CGI::Cookie.parse]({%link 2021-11-24-cookie-prefix-spoofing-in-cgi-cookie-parse-cve-2021-41819.md %}) + +See the [commit logs](https://github.com/ruby/ruby/compare/v2_7_4...v2_7_5) for details. + +## Download + +{% assign release = site.data.releases | where: "version", "2.7.5" | first %} + +* <{{ release.url.bz2 }}> + + SIZE: {{ release.size.bz2 }} + SHA1: {{ release.sha1.bz2 }} + SHA256: {{ release.sha256.bz2 }} + SHA512: {{ release.sha512.bz2 }} + +* <{{ release.url.gz }}> + + SIZE: {{ release.size.gz }} + SHA1: {{ release.sha1.gz }} + SHA256: {{ release.sha256.gz }} + SHA512: {{ release.sha512.gz }} + +* <{{ release.url.xz }}> + + SIZE: {{ release.size.xz }} + SHA1: {{ release.sha1.xz }} + SHA256: {{ release.sha256.xz }} + SHA512: {{ release.sha512.xz }} + +* <{{ release.url.zip }}> + + SIZE: {{ release.size.zip }} + SHA1: {{ release.sha1.zip }} + SHA256: {{ release.sha256.zip }} + SHA512: {{ release.sha512.zip }} + +## Release Comment + +Many committers, developers, and users who provided bug reports helped us make this release. +Thanks for their contributions. + +The maintenance of Ruby 2.7, including this release, is based on the "Agreement for the Ruby stable version" of the Ruby Association. diff --git a/en/news/_posts/2021-11-24-ruby-3-0-3-released.md b/en/news/_posts/2021-11-24-ruby-3-0-3-released.md new file mode 100644 index 0000000000..cbfe661807 --- /dev/null +++ b/en/news/_posts/2021-11-24-ruby-3-0-3-released.md @@ -0,0 +1,49 @@ +--- +layout: news_post +title: "Ruby 3.0.3 Released" +author: "nagachika" +translator: +date: 2021-11-24 12:00:00 +0000 +lang: en +--- + +Ruby 3.0.3 has been released. + +This release includes security fixes. +Please check the topics below for details. + +* [CVE-2021-41817: Regular Expression Denial of Service Vulnerability of Date Parsing Methods]({%link 2021-11-15-date-parsing-method-regexp-dos-cve-2021-41817.md %}) +* [CVE-2021-41816: Buffer Overrun in CGI.escape_html]({%link 2021-11-24-buffer-overrun-in-cgi-escape_html-cve-2021-41816.md %}) +* [CVE-2021-41819: Cookie Prefix Spoofing in CGI::Cookie.parse]({%link 2021-11-24-cookie-prefix-spoofing-in-cgi-cookie-parse-cve-2021-41819.md %}) + +See the [commit logs](https://github.com/ruby/ruby/compare/v3_0_2...v3_0_3) for details. + +## Download + +{% assign release = site.data.releases | where: "version", "3.0.3" | first %} + +* <{{ release.url.gz }}> + + SIZE: {{ release.size.gz }} + SHA1: {{ release.sha1.gz }} + SHA256: {{ release.sha256.gz }} + SHA512: {{ release.sha512.gz }} + +* <{{ release.url.xz }}> + + SIZE: {{ release.size.xz }} + SHA1: {{ release.sha1.xz }} + SHA256: {{ release.sha256.xz }} + SHA512: {{ release.sha512.xz }} + +* <{{ release.url.zip }}> + + SIZE: {{ release.size.zip }} + SHA1: {{ release.sha1.zip }} + SHA256: {{ release.sha256.zip }} + SHA512: {{ release.sha512.zip }} + +## Release Comment + +Many committers, developers, and users who provided bug reports helped us make this release. +Thanks for their contributions. From e0e0676c982108ac81c910bb6aba630bcd91430c Mon Sep 17 00:00:00 2001 From: nagachika Date: Wed, 24 Nov 2021 21:49:49 +0900 Subject: [PATCH 0070/1090] Update _data/downloads.yml and _data/releases.yml --- _data/downloads.yml | 6 ++-- _data/releases.yml | 82 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 85 insertions(+), 3 deletions(-) diff --git a/_data/downloads.yml b/_data/downloads.yml index ff61bd1094..54a2601a06 100644 --- a/_data/downloads.yml +++ b/_data/downloads.yml @@ -8,13 +8,13 @@ preview: stable: - - 3.0.2 - - 2.7.4 + - 3.0.3 + - 2.7.5 # optional security_maintenance: - - 2.6.8 + - 2.6.9 # optional eol: diff --git a/_data/releases.yml b/_data/releases.yml index 15878152b8..82ff598065 100644 --- a/_data/releases.yml +++ b/_data/releases.yml @@ -52,6 +52,30 @@ # 3.0 series +- version: 3.0.3 + date: '2021-11-24' + post: "/en/news/2021/11/24/ruby-3-0-3-released/" + url: + gz: https://cache.ruby-lang.org/pub/ruby/3.0/ruby-3.0.3.tar.gz + xz: https://cache.ruby-lang.org/pub/ruby/3.0/ruby-3.0.3.tar.xz + zip: https://cache.ruby-lang.org/pub/ruby/3.0/ruby-3.0.3.zip + size: + gz: 20242729 + xz: 14991880 + zip: 24627744 + sha1: + gz: '049317b7c6246d6ea86564c3f73a629b766ff634' + xz: c1e6dac2b8c08afbbee39e25e325c84e1cab7c17 + zip: 5341ed1602a3289c4857560ead53191895e5c586 + sha256: + gz: 3586861cb2df56970287f0fd83f274bd92058872d830d15570b36def7f1a92ac + xz: 88cc7f0f021f15c4cd62b1f922e3a401697f7943551fe45b1fdf4f2417a17a9c + zip: 0b8370e404550bf736f46307a14eb9306a7868fb8d54e1418ecdaccbaa8ac06f + sha512: + gz: 39dab51a0d784a38302372b99f96205817d466245202586d22123745761e9cb39db128ec2b984ebc3919b9faf2adf828d19c97d3fb1e56d44be0a81dc5d11b87 + xz: bb9ea426278d5a7ac46595296f03b82d43df8b7db41045cdf85611e05e26c703c53f700494cd7cf5d4c27fa953bdc5c144317d7720812db0a6e3b6f4bc4d2e00 + zip: 24c2a4f455f90e54f85d9565e392519833b36aefce32dc707e6693994d175c82e84ee6c37ed4a9ddf8840479e7cdfaae714c12bc6923368bb00346d4edd434d8 + - version: 3.0.2 date: '2021-07-07' post: "/en/news/2021/07/07/ruby-3-0-2-released/" @@ -220,6 +244,35 @@ # 2.7 series +- version: 2.7.5 + date: '2021-11-24' + post: "/en/news/2021/11/24/ruby-2-7-5-released/" + url: + bz2: https://cache.ruby-lang.org/pub/ruby/2.7/ruby-2.7.5.tar.bz2 + gz: https://cache.ruby-lang.org/pub/ruby/2.7/ruby-2.7.5.tar.gz + xz: https://cache.ruby-lang.org/pub/ruby/2.7/ruby-2.7.5.tar.xz + zip: https://cache.ruby-lang.org/pub/ruby/2.7/ruby-2.7.5.zip + size: + bz2: 14805180 + gz: 16923709 + xz: 12072980 + zip: 20702176 + sha1: + bz2: 2a179b601f45172b1cb38e8f157c4e6ce272c22c + gz: c2d0f6c793f9e673f9fb22276d32f8c395ec5581 + xz: 1d04fbf24150eaa1297a7ef4c7057ec0a9dca527 + zip: 541b34fa5e7e55b6269a2bfa67e2a06ad0dcb571 + sha256: + bz2: d6b444341a5e06fcd6eaf1feb83a1c0c2da4705dbe4f275ee851761b185f4bd1 + gz: 2755b900a21235b443bb16dadd9032f784d4a88f143d852bc5d154f22b8781f1 + xz: d216d95190eaacf3bf165303747b02ff13f10b6cfab67a9031b502a49512b516 + zip: 3793d764ec8da68203eba1a7fe338fae9bafa8226cce911c8648c1b7c32ba9c2 + sha512: + bz2: 0aa2ac44bc22859a39c43d08b7c7f457df05c2dc36b2574fd70ca399143ef1000dc5e496212db9eb055bc4258523d47d26db3c57a1a5a5d63cf1b3de9f81645a + gz: '09e029b5cc15b6e4e37bcf15adb28213eaedec3ea22106d63095b37ea6b2a2b68e82e74e6b50746c87dd77e5185795d014e0db118bf0f45ffa0b0a307f5f65da' + xz: 21c8a713e3ce115fc4c405113ac691ddcefc3419f528b93ca1ac59e7052c1b6e9e241da0e570e291e567f28f3d840824dbcc5967b216cbe7d6ca7a05580fa311 + zip: fe9a706f8139e59a40ab205dc88cdc613c9c69186cb2daeb5adc80bdf45290a523fa7e3fd0866fa12325039ba413ff1e1f4233073d352da08079dc903063b31a + - version: 2.7.4 date: '2021-07-07' post: "/en/news/2021/07/07/ruby-2-7-4-released/" @@ -495,6 +548,35 @@ # 2.6 series +- version: 2.6.9 + date: '2021-11-24' + post: "/en/news/2021/11/24/ruby-2-6-9-released/" + url: + bz2: https://cache.ruby-lang.org/pub/ruby/2.6/ruby-2.6.9.tar.bz2 + gz: https://cache.ruby-lang.org/pub/ruby/2.6/ruby-2.6.9.tar.gz + xz: https://cache.ruby-lang.org/pub/ruby/2.6/ruby-2.6.9.tar.xz + zip: https://cache.ruby-lang.org/pub/ruby/2.6/ruby-2.6.9.zip + size: + bz2: 14137792 + gz: 16202802 + xz: 11590064 + zip: 19869379 + sha1: + bz2: a482c36645e7ff4596c6aca2cf96d15481fcfc5e + gz: 00e69747e7e2b87155c65b4003470313e4403b0a + xz: fc67ca162010aac4af49d73a8c48be5cb2fb5907 + zip: 41a60c783306f4b47b867bd19d16688b546b8e3a + sha256: + bz2: a0639060c4519572e51828eb742f09dd40f154c820f6007246de7a2090e3ee45 + gz: eb7bae7aac64bf9eb2153710a4cafae450ccbb62ae6f63d573e1786178b0efbb + xz: 6a041d82ae6e0f02ccb1465e620d94a7196489d8a13d6018a160da42ebc1eece + zip: 2480dbdc72d3dc832d8254e938e4861ca54a5337edd6f358e5202fd2a5339eec + sha512: + bz2: ff067ebc059094c0a9a0debf54a37aad2c85f7ed47be59299041c9c03a7701529f5063ff32a1b8c56d48ee8585015acba63602ed0176b2797d263d43d67aa241 + gz: 24bd6c8f528907349bcf392ed75a2d767b93a35a9f4c839267873d1dde862d3292d1682e0edc56c078a2690de76a045ef866f54eab8a330a18771f0b234c5993 + xz: f60aa89e685cea324185eb0d13e6b44caef4e4f761cbf9ea1386ae70e39faf3866ac01e4bb5354574f2583e74290b8c80eaf63d126040d52368be6c771476451 + zip: 9073e0fc5040434f15158f24c6a551286bc5f1c4c1cb54d6e3debb4ac039187a4f274a217bdb5c8489c72360c65d708f89eb0f2472a1f9232fcfee8e296dec57 + - version: 2.6.8 date: '2021-07-07' post: "/en/news/2021/07/07/ruby-2-6-8-released/" From 4bf4abd033de802876e8427560c3815160d81969 Mon Sep 17 00:00:00 2001 From: Yusuke Endoh Date: Wed, 24 Nov 2021 21:55:29 +0900 Subject: [PATCH 0071/1090] Fix paths to security announcements --- ...1-24-buffer-overrun-in-cgi-escape_html-cve-2021-41816.md | 2 +- en/news/_posts/2021-11-24-ruby-2-6-9-released.md | 4 ++-- en/news/_posts/2021-11-24-ruby-2-7-5-released.md | 6 +++--- en/news/_posts/2021-11-24-ruby-3-0-3-released.md | 6 +++--- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/en/news/_posts/2021-11-24-buffer-overrun-in-cgi-escape_html-cve-2021-41816.md b/en/news/_posts/2021-11-24-buffer-overrun-in-cgi-escape_html-cve-2021-41816.md index 295402c7bb..d4d131f3e7 100644 --- a/en/news/_posts/2021-11-24-buffer-overrun-in-cgi-escape_html-cve-2021-41816.md +++ b/en/news/_posts/2021-11-24-buffer-overrun-in-cgi-escape_html-cve-2021-41816.md @@ -1,6 +1,6 @@ --- layout: news_post -title: "CVE-2021-41816: Buffer Overrun in CGI.escape_html +title: "CVE-2021-41816: Buffer Overrun in CGI.escape_html" author: "mame" translator: date: 2021-11-24 12:00:00 +0000 diff --git a/en/news/_posts/2021-11-24-ruby-2-6-9-released.md b/en/news/_posts/2021-11-24-ruby-2-6-9-released.md index c77b23e7ed..d331c95b12 100644 --- a/en/news/_posts/2021-11-24-ruby-2-6-9-released.md +++ b/en/news/_posts/2021-11-24-ruby-2-6-9-released.md @@ -12,8 +12,8 @@ Ruby 2.6.9 has been released. This release includes security fixes. Please check the topics below for details. -* [CVE-2021-41817: Regular Expression Denial of Service Vulnerability of Date Parsing Methods]({%link 2021-11-15-date-parsing-method-regexp-dos-cve-2021-41817.md %}) -* [CVE-2021-41819: Cookie Prefix Spoofing in CGI::Cookie.parse]({%link 2021-11-24-cookie-prefix-spoofing-in-cgi-cookie-parse-cve-2021-41819.md %}) +* [CVE-2021-41817: Regular Expression Denial of Service Vulnerability of Date Parsing Methods]({%link en/news/_posts/2021-11-15-date-parsing-method-regexp-dos-cve-2021-41817.md %}) +* [CVE-2021-41819: Cookie Prefix Spoofing in CGI::Cookie.parse]({%link en/news/_posts/2021-11-24-cookie-prefix-spoofing-in-cgi-cookie-parse-cve-2021-41819.md %}) See the [commit logs](https://github.com/ruby/ruby/compare/v2_6_8...v2_6_9) for details. diff --git a/en/news/_posts/2021-11-24-ruby-2-7-5-released.md b/en/news/_posts/2021-11-24-ruby-2-7-5-released.md index f1ec0cfee1..12148db025 100644 --- a/en/news/_posts/2021-11-24-ruby-2-7-5-released.md +++ b/en/news/_posts/2021-11-24-ruby-2-7-5-released.md @@ -12,9 +12,9 @@ Ruby 2.7.5 has been released. This release includes security fixes. Please check the topics below for details. -* [CVE-2021-41817: Regular Expression Denial of Service Vulnerability of Date Parsing Methods]({%link 2021-11-15-date-parsing-method-regexp-dos-cve-2021-41817.md %}) -* [CVE-2021-41816: Buffer Overrun in CGI.escape_html]({%link 2021-11-24-buffer-overrun-in-cgi-escape_html-cve-2021-41816.md %}) -* [CVE-2021-41819: Cookie Prefix Spoofing in CGI::Cookie.parse]({%link 2021-11-24-cookie-prefix-spoofing-in-cgi-cookie-parse-cve-2021-41819.md %}) +* [CVE-2021-41817: Regular Expression Denial of Service Vulnerability of Date Parsing Methods]({%link en/news/_posts/2021-11-15-date-parsing-method-regexp-dos-cve-2021-41817.md %}) +* [CVE-2021-41816: Buffer Overrun in CGI.escape_html]({%link en/news/_posts/2021-11-24-buffer-overrun-in-cgi-escape_html-cve-2021-41816.md %}) +* [CVE-2021-41819: Cookie Prefix Spoofing in CGI::Cookie.parse]({%link en/news/_posts/2021-11-24-cookie-prefix-spoofing-in-cgi-cookie-parse-cve-2021-41819.md %}) See the [commit logs](https://github.com/ruby/ruby/compare/v2_7_4...v2_7_5) for details. diff --git a/en/news/_posts/2021-11-24-ruby-3-0-3-released.md b/en/news/_posts/2021-11-24-ruby-3-0-3-released.md index cbfe661807..6f98e03b33 100644 --- a/en/news/_posts/2021-11-24-ruby-3-0-3-released.md +++ b/en/news/_posts/2021-11-24-ruby-3-0-3-released.md @@ -12,9 +12,9 @@ Ruby 3.0.3 has been released. This release includes security fixes. Please check the topics below for details. -* [CVE-2021-41817: Regular Expression Denial of Service Vulnerability of Date Parsing Methods]({%link 2021-11-15-date-parsing-method-regexp-dos-cve-2021-41817.md %}) -* [CVE-2021-41816: Buffer Overrun in CGI.escape_html]({%link 2021-11-24-buffer-overrun-in-cgi-escape_html-cve-2021-41816.md %}) -* [CVE-2021-41819: Cookie Prefix Spoofing in CGI::Cookie.parse]({%link 2021-11-24-cookie-prefix-spoofing-in-cgi-cookie-parse-cve-2021-41819.md %}) +* [CVE-2021-41817: Regular Expression Denial of Service Vulnerability of Date Parsing Methods]({%link en/news/_posts/2021-11-15-date-parsing-method-regexp-dos-cve-2021-41817.md %}) +* [CVE-2021-41816: Buffer Overrun in CGI.escape_html]({%link en/news/_posts/2021-11-24-buffer-overrun-in-cgi-escape_html-cve-2021-41816.md %}) +* [CVE-2021-41819: Cookie Prefix Spoofing in CGI::Cookie.parse]({%link en/news/_posts/2021-11-24-cookie-prefix-spoofing-in-cgi-cookie-parse-cve-2021-41819.md %}) See the [commit logs](https://github.com/ruby/ruby/compare/v3_0_2...v3_0_3) for details. From 1bc1ca7aa3a699d4aaafaa21455b05b9e62edcee Mon Sep 17 00:00:00 2001 From: Yusuke Endoh Date: Wed, 24 Nov 2021 22:09:28 +0900 Subject: [PATCH 0072/1090] CVE-2021-41817: Mention CVE number --- .../2021-11-15-date-parsing-method-regexp-dos-cve-2021-41817.md | 1 + 1 file changed, 1 insertion(+) diff --git a/en/news/_posts/2021-11-15-date-parsing-method-regexp-dos-cve-2021-41817.md b/en/news/_posts/2021-11-15-date-parsing-method-regexp-dos-cve-2021-41817.md index 9306b21675..ba7f5d48c8 100644 --- a/en/news/_posts/2021-11-15-date-parsing-method-regexp-dos-cve-2021-41817.md +++ b/en/news/_posts/2021-11-15-date-parsing-method-regexp-dos-cve-2021-41817.md @@ -9,6 +9,7 @@ lang: en --- We have released date gem version 3.2.1, 3.1.2, 3.0.2, and 2.0.1 that include a security fix for a regular expression denial of service vulnerability (ReDoS) on date parsing methods. An attacker can exploit this vulnerability to cause an effective DoS attack. +This vulnerability has been assigned the CVE identifier [CVE-2021-41817](https://nvd.nist.gov/vuln/detail/CVE-2021-41817). ## Details From 02a8c620346bc773df34d4c8ef4ed2593b326afe Mon Sep 17 00:00:00 2001 From: "U.Nakamura" Date: Wed, 24 Nov 2021 22:25:14 +0900 Subject: [PATCH 0073/1090] Mention about newer Ruby releases --- ...11-15-date-parsing-method-regexp-dos-cve-2021-41817.md | 8 +++++--- ...24-buffer-overrun-in-cgi-escape_html-cve-2021-41816.md | 4 ++-- ...-prefix-spoofing-in-cgi-cookie-parse-cve-2021-41819.md | 4 ++-- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/en/news/_posts/2021-11-15-date-parsing-method-regexp-dos-cve-2021-41817.md b/en/news/_posts/2021-11-15-date-parsing-method-regexp-dos-cve-2021-41817.md index ba7f5d48c8..a67e911725 100644 --- a/en/news/_posts/2021-11-15-date-parsing-method-regexp-dos-cve-2021-41817.md +++ b/en/news/_posts/2021-11-15-date-parsing-method-regexp-dos-cve-2021-41817.md @@ -18,12 +18,13 @@ Date's parsing methods including `Date.parse` are using Regexps internally, some The fix limits the input length up to 128 bytes by default instead of changing the regexps. This is because Date gem uses many Regexps and it is possible that there are still undiscovered vulnerable Regexps. For compatibility, it is allowed to remove the limitation by explicitly passing `limit` keywords as `nil` like `Date.parse(str, limit: nil)`, but note that it may take a long time to parse. Please update the date gem to version 3.2.1, 3.1.2, 3.0.2, and 2.0.1, or later. You can use `gem update date` to update it. If you are using bundler, please add `gem "date", ">= 3.2.1"` to your `Gemfile`. +Alternatively, you can update Ruby to 3.0.3, 2.7.5, 2.6.9 or later. ## Affected versions -* date gem 2.0.0 or prior (which are bundled versions with Ruby 2.6 series) -* date gem 3.0.1 or prior (which are bundled versions with Ruby 2.7 series) -* date gem 3.1.1 or prior (which are bundled versions with Ruby 3.0 series) +* date gem 2.0.0 or prior (which are bundled versions with Ruby 2.6 series prior to Ruby 2.6.9) +* date gem 3.0.1 or prior (which are bundled versions with Ruby 2.7 series prior to Ruby 2.7.5) +* date gem 3.1.1 or prior (which are bundled versions with Ruby 3.0 series prior to Ruby 3.0.3) * date gem 3.2.0 or prior ## Credits @@ -33,3 +34,4 @@ Thanks to [svalkanov](https://github.com/SValkanov/) for discovering this issue. ## History * Originally published at 2021-11-15 08:00:00 (UTC) +* Mention about new Ruby releases at 2021-11-24 13:20:00 (UTC) diff --git a/en/news/_posts/2021-11-24-buffer-overrun-in-cgi-escape_html-cve-2021-41816.md b/en/news/_posts/2021-11-24-buffer-overrun-in-cgi-escape_html-cve-2021-41816.md index d4d131f3e7..01fe66fc93 100644 --- a/en/news/_posts/2021-11-24-buffer-overrun-in-cgi-escape_html-cve-2021-41816.md +++ b/en/news/_posts/2021-11-24-buffer-overrun-in-cgi-escape_html-cve-2021-41816.md @@ -23,8 +23,8 @@ This issue has been introduced since Ruby 2.7, so the cgi version bundled with R ## Affected versions -* cgi gem 0.1.0 or prior (which are bundled versions with Ruby 2.7 series) -* cgi gem 0.2.0 or prior (which are bundled versions with Ruby 3.0 series) +* cgi gem 0.1.0 or prior (which are bundled versions with Ruby 2.7 series prior to Ruby 2.7.5) +* cgi gem 0.2.0 or prior (which are bundled versions with Ruby 3.0 series prior to Ruby 3.0.3) * cgi gem 0.3.0 or prior ## Credits diff --git a/en/news/_posts/2021-11-24-cookie-prefix-spoofing-in-cgi-cookie-parse-cve-2021-41819.md b/en/news/_posts/2021-11-24-cookie-prefix-spoofing-in-cgi-cookie-parse-cve-2021-41819.md index 819535495c..7db6824007 100644 --- a/en/news/_posts/2021-11-24-cookie-prefix-spoofing-in-cgi-cookie-parse-cve-2021-41819.md +++ b/en/news/_posts/2021-11-24-cookie-prefix-spoofing-in-cgi-cookie-parse-cve-2021-41819.md @@ -34,8 +34,8 @@ If you are using Ruby 2.6: ## Affected versions * ruby 2.6.8 or prior (You can *not* use `gem update cgi` for this version.) -* cgi gem 0.1.0 or prior (which are bundled versions with Ruby 2.7 series) -* cgi gem 0.2.0 or prior (which are bundled versions with Ruby 3.0 series) +* cgi gem 0.1.0 or prior (which are bundled versions with Ruby 2.7 series prior to Ruby 2.7.5) +* cgi gem 0.2.0 or prior (which are bundled versions with Ruby 3.0 series prior to Ruby 3.0.3) * cgi gem 0.3.0 or prior ## Credits From ce20e7f9ae6a7ceae9b54843b283727645da338a Mon Sep 17 00:00:00 2001 From: "U.Nakamura" Date: Wed, 24 Nov 2021 22:33:42 +0900 Subject: [PATCH 0074/1090] Japanese translations of Ruby releases --- .../_posts/2021-11-24-ruby-2-6-9-released.md | 59 +++++++++++++++++++ .../_posts/2021-11-24-ruby-2-7-5-released.md | 57 ++++++++++++++++++ .../_posts/2021-11-24-ruby-3-0-3-released.md | 48 +++++++++++++++ 3 files changed, 164 insertions(+) create mode 100644 ja/news/_posts/2021-11-24-ruby-2-6-9-released.md create mode 100644 ja/news/_posts/2021-11-24-ruby-2-7-5-released.md create mode 100644 ja/news/_posts/2021-11-24-ruby-3-0-3-released.md diff --git a/ja/news/_posts/2021-11-24-ruby-2-6-9-released.md b/ja/news/_posts/2021-11-24-ruby-2-6-9-released.md new file mode 100644 index 0000000000..54370aec78 --- /dev/null +++ b/ja/news/_posts/2021-11-24-ruby-2-6-9-released.md @@ -0,0 +1,59 @@ +--- +layout: news_post +title: "Ruby 2.6.9 リリース" +author: "usa" +translator: +date: 2021-11-24 12:00:00 +0000 +lang: ja +--- + +Ruby 2.6.9 がリリースされました。 + +このリリースでは以下の脆弱性修正が含まれています。 +詳しくは以下の記事などを参照してください。 + +* [CVE-2021-41817: Regular Expression Denial of Service Vulnerability of Date Parsing Methods]({%link en/news/_posts/2021-11-15-date-parsing-method-regexp-dos-cve-2021-41817.md %}) +* [CVE-2021-41819: Cookie Prefix Spoofing in CGI::Cookie.parse]({%link en/news/_posts/2021-11-24-cookie-prefix-spoofing-in-cgi-cookie-parse-cve-2021-41819.md %}) + +詳しくは [commit log](https://github.com/ruby/ruby/compare/v2_6_8...v2_6_9) を参照してください。 + +Ruby 2.6 系列は、現在、セキュリティメンテナンスフェーズにあります。 +このフェーズ中は、重大なセキュリティ上の問題への対応のみが行われます。 +現在の予定では、2022 年 3 月末頃を目処に、2.6 系列のセキュリティメンテナンスならびに公式サポートは終了する見込みです。 +現在、2.6 系列を利用しているユーザーの皆さんは、なるべく早く、3.0 系列等のより新しいバージョン系列の Ruby への移行を検討されるよう、お勧めします。 + +## ダウンロード + +{% assign release = site.data.releases | where: "version", "2.6.9" | first %} + +* <{{ release.url.bz2 }}> + + SIZE: {{ release.size.bz2 }} + SHA1: {{ release.sha1.bz2 }} + SHA256: {{ release.sha256.bz2 }} + SHA512: {{ release.sha512.bz2 }} + +* <{{ release.url.gz }}> + + SIZE: {{ release.size.gz }} + SHA1: {{ release.sha1.gz }} + SHA256: {{ release.sha256.gz }} + SHA512: {{ release.sha512.gz }} + +* <{{ release.url.xz }}> + + SIZE: {{ release.size.xz }} + SHA1: {{ release.sha1.xz }} + SHA256: {{ release.sha256.xz }} + SHA512: {{ release.sha512.xz }} + +* <{{ release.url.zip }}> + + SIZE: {{ release.size.zip }} + SHA1: {{ release.sha1.zip }} + SHA256: {{ release.sha256.zip }} + SHA512: {{ release.sha512.zip }} + +## リリースコメント + +このリリースに協力してくださった皆様、特に、脆弱性を報告してくださった方々に深く感謝します。 diff --git a/ja/news/_posts/2021-11-24-ruby-2-7-5-released.md b/ja/news/_posts/2021-11-24-ruby-2-7-5-released.md new file mode 100644 index 0000000000..79f7898c56 --- /dev/null +++ b/ja/news/_posts/2021-11-24-ruby-2-7-5-released.md @@ -0,0 +1,57 @@ +--- +layout: news_post +title: "Ruby 2.7.5 リリース" +author: "usa" +translator: +date: 2021-11-24 12:00:00 +0000 +lang: ja +--- + +Ruby 2.7.5 がリリースされました。 + +このリリースでは以下の脆弱性修正が含まれています。 +詳しくは以下の記事などを参照してください。 + +* [CVE-2021-41817: Regular Expression Denial of Service Vulnerability of Date Parsing Methods]({%link en/news/_posts/2021-11-15-date-parsing-method-regexp-dos-cve-2021-41817.md %}) +* [CVE-2021-41816: Buffer Overrun in CGI.escape_html]({%link en/news/_posts/2021-11-24-buffer-overrun-in-cgi-escape_html-cve-2021-41816.md %}) +* [CVE-2021-41819: Cookie Prefix Spoofing in CGI::Cookie.parse]({%link en/news/_posts/2021-11-24-cookie-prefix-spoofing-in-cgi-cookie-parse-cve-2021-41819.md %}) + +その他の変更については [commit log](https://github.com/ruby/ruby/compare/v2_7_4...v2_7_5) を参照してください。 + +## ダウンロード + +{% assign release = site.data.releases | where: "version", "2.7.5" | first %} + +* <{{ release.url.bz2 }}> + + SIZE: {{ release.size.bz2 }} + SHA1: {{ release.sha1.bz2 }} + SHA256: {{ release.sha256.bz2 }} + SHA512: {{ release.sha512.bz2 }} + +* <{{ release.url.gz }}> + + SIZE: {{ release.size.gz }} + SHA1: {{ release.sha1.gz }} + SHA256: {{ release.sha256.gz }} + SHA512: {{ release.sha512.gz }} + +* <{{ release.url.xz }}> + + SIZE: {{ release.size.xz }} + SHA1: {{ release.sha1.xz }} + SHA256: {{ release.sha256.xz }} + SHA512: {{ release.sha512.xz }} + +* <{{ release.url.zip }}> + + SIZE: {{ release.size.zip }} + SHA1: {{ release.sha1.zip }} + SHA256: {{ release.sha256.zip }} + SHA512: {{ release.sha512.zip }} + +## リリースコメント + +Ruby 開発者の皆様、バグや脆弱性を報告してくれたユーザーの皆様のご協力により本リリースは行われています。 皆様のご協力に感謝します。 + +本リリースを含む Ruby 2.7 のメンテナンスは Ruby アソシエーションの「Ruby 安定版保守事業」に基づき行われています。 diff --git a/ja/news/_posts/2021-11-24-ruby-3-0-3-released.md b/ja/news/_posts/2021-11-24-ruby-3-0-3-released.md new file mode 100644 index 0000000000..54e009a6aa --- /dev/null +++ b/ja/news/_posts/2021-11-24-ruby-3-0-3-released.md @@ -0,0 +1,48 @@ +--- +layout: news_post +title: "Ruby 3.0.3 リリース" +author: "nagachika" +translator: "usa" +date: 2021-11-24 12:00:00 +0000 +lang: ja +--- + +Ruby 3.0.3 がリリースされました。 + +このリリースでは以下の脆弱性修正が含まれています。 +詳しくは以下の記事などを参照してください。 + +* [CVE-2021-41817: Regular Expression Denial of Service Vulnerability of Date Parsing Methods]({%link en/news/_posts/2021-11-15-date-parsing-method-regexp-dos-cve-2021-41817.md %}) +* [CVE-2021-41816: Buffer Overrun in CGI.escape_html]({%link en/news/_posts/2021-11-24-buffer-overrun-in-cgi-escape_html-cve-2021-41816.md %}) +* [CVE-2021-41819: Cookie Prefix Spoofing in CGI::Cookie.parse]({%link en/news/_posts/2021-11-24-cookie-prefix-spoofing-in-cgi-cookie-parse-cve-2021-41819.md %}) + +その他の変更については [commit log](https://github.com/ruby/ruby/compare/v3_0_2...v3_0_3) を参照してください。 + +## ダウンロード + +{% assign release = site.data.releases | where: "version", "3.0.3" | first %} + +* <{{ release.url.gz }}> + + SIZE: {{ release.size.gz }} + SHA1: {{ release.sha1.gz }} + SHA256: {{ release.sha256.gz }} + SHA512: {{ release.sha512.gz }} + +* <{{ release.url.xz }}> + + SIZE: {{ release.size.xz }} + SHA1: {{ release.sha1.xz }} + SHA256: {{ release.sha256.xz }} + SHA512: {{ release.sha512.xz }} + +* <{{ release.url.zip }}> + + SIZE: {{ release.size.zip }} + SHA1: {{ release.sha1.zip }} + SHA256: {{ release.sha256.zip }} + SHA512: {{ release.sha512.zip }} + +## リリースコメント + +このリリースにあたり、多くのコミッター、開発者、バグ報告をしてくれたユーザーの皆様に感謝を申し上げます。 From b81a58d0a54adf0c00e6b46a1ab32ceeb274ef89 Mon Sep 17 00:00:00 2001 From: jinroq <2787780+jinroq@users.noreply.github.com> Date: Thu, 25 Nov 2021 17:05:38 +0900 Subject: [PATCH 0075/1090] Japanese translation of "CVE-2021-41819: Cookie Prefix Spoofing in CGI::Cookie.parse" Translate [https://github.com/ruby/www.ruby-lang.org/blob/master/en/news/_posts/2021-11-24-cookie-prefix-spoofing-in-cgi-cookie-parse-cve-2021-41819.md](https://github.com/ruby/www.ruby-lang.org/blob/master/en/news/_posts/2021-11-24-cookie-prefix-spoofing-in-cgi-cookie-parse-cve-2021-41819.md) to ja. --- ...fing-in-cgi-cookie-parse-cve-2021-41819.md | 47 +++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 ja/news/_posts/2021-11-24-cookie-prefix-spoofing-in-cgi-cookie-parse-cve-2021-41819.md diff --git a/ja/news/_posts/2021-11-24-cookie-prefix-spoofing-in-cgi-cookie-parse-cve-2021-41819.md b/ja/news/_posts/2021-11-24-cookie-prefix-spoofing-in-cgi-cookie-parse-cve-2021-41819.md new file mode 100644 index 0000000000..5296d1d12f --- /dev/null +++ b/ja/news/_posts/2021-11-24-cookie-prefix-spoofing-in-cgi-cookie-parse-cve-2021-41819.md @@ -0,0 +1,47 @@ +--- +layout: news_post +title: "CVE-2021-41819: CGI::Cookie.parse 内の Cookie プレフィックスの偽装" +author: "mame" +translator: "jinroq" +date: 2021-11-24 12:00:00 +0000 +tags: security +lang: ja +--- + +CGI :: Cookie.parse 内で Cookie プレフィックスを偽装する脆弱性が発見されました。 +この脆弱性は、[CVE-2021-41819](https://nvd.nist.gov/vuln/detail/CVE-2021-41819) として登録されています。 +Ruby をアップグレードすることを強く推奨します。 + +## 詳細 + +古いバージョンの `CGI :: Cookie.parse` は、Cookie 名 に URL デコード を適用していました。 +ところが、悪意を持った攻撃者はこの脆弱性を利用して Cookie 名のセキュリティプレフィックスを偽装し、脆弱なアプリケーションをだます可能性があります。 + +この修正により、 `CGI :: Cookie.parse` は Cookie 名をデコードしなくなりました。 +使用している Cookie 名に、URL エンコードされた英数字以外の文字が含まれている場合、これは非互換であることに注意してください。 + +これは [CVE-2020-8184](https://nvd.nist.gov/vuln/detail/CVE-2020-8184) と同じ問題です。 + +Ruby 2.7 もしくは 3.0 を使用している場合: + +* cgi gem をバージョン 0.3.1, 0.2.1, 0.1.1 もしくはこれら以上のバージョンに更新してください。 `gem update cgi` を使用して更新できます。bundler を使用している場合は、 `Gemfile` に `gem "cgi", "> = 0.3.1"` を追加してください。 +* または、Ruby を 2.7.5 または 3.0.3 に更新してください。 + +Ruby 2.6 を使用している場合: + +* Rubyを 2.6.9 に更新してください。 *Ruby 2.6 以前では `gem update cgi` は使用できません。* + +## 影響を受けるバージョン + +* ruby​​ 2.6.8 以前(このバージョンでは `gem update cgi` を *使用できません*。) +* cgi gem 0.1.0 以前(Ruby 2.7.5 より前にバンドルされている Ruby 2.7 系列) +* cgi gem 0.2.0 以前(Ruby 3.0.3 より前にバンドルされている Ruby3.0 系列) +* cgi gem 0.3.0 以前 + +## クレジット + +この脆弱性情報は、[ooooooo_q](https://hackerone.com/ooooooo_q) 氏によって報告されました。 + +## 更新履歴 + +* 2021-11-24 21:00:00 (JST) 初版 From 9c7a4efab47960ddbbf17df91090b941f4fd2214 Mon Sep 17 00:00:00 2001 From: jinroq <2787780+jinroq@users.noreply.github.com> Date: Fri, 26 Nov 2021 16:10:04 +0900 Subject: [PATCH 0076/1090] Fixed a command `gem upgrade rexml` -> `gem update rexml` --- ...4-05-xml-round-trip-vulnerability-in-rexml-cve-2021-28965.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/en/news/_posts/2021-04-05-xml-round-trip-vulnerability-in-rexml-cve-2021-28965.md b/en/news/_posts/2021-04-05-xml-round-trip-vulnerability-in-rexml-cve-2021-28965.md index f4b0a0acf7..b6225aa9cc 100644 --- a/en/news/_posts/2021-04-05-xml-round-trip-vulnerability-in-rexml-cve-2021-28965.md +++ b/en/news/_posts/2021-04-05-xml-round-trip-vulnerability-in-rexml-cve-2021-28965.md @@ -29,7 +29,7 @@ If you are using Ruby 2.5.8 or prior: ## Affected versions -* Ruby 2.5.8 or prior (You can NOT use `gem upgrade rexml` for this version.) +* Ruby 2.5.8 or prior (You can NOT use `gem update rexml` for this version.) * Ruby 2.6.6 or prior * Ruby 2.7.2 or prior * Ruby 3.0.0 From af0e7e8562e60de55cd8fb9c3862a0f99d2e0f8c Mon Sep 17 00:00:00 2001 From: jinroq <2787780+jinroq@users.noreply.github.com> Date: Fri, 26 Nov 2021 21:21:41 +0900 Subject: [PATCH 0077/1090] Fixed a bug. Fixed a bug that disturbed XXX from being displayed. --- en/news/_posts/2021-11-09-ruby-3-1-0-preview1-released.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/en/news/_posts/2021-11-09-ruby-3-1-0-preview1-released.md b/en/news/_posts/2021-11-09-ruby-3-1-0-preview1-released.md index 7904833062..3afcf4a576 100644 --- a/en/news/_posts/2021-11-09-ruby-3-1-0-preview1-released.md +++ b/en/news/_posts/2021-11-09-ruby-3-1-0-preview1-released.md @@ -7,10 +7,9 @@ date: 2021-11-09 00:00:00 +0000 lang: en --- -We are pleased to announce the release of Ruby {{ release.version }}. - {% assign release = site.data.releases | where: "version", "3.1.0-preview1" | first %} +We are pleased to announce the release of Ruby {{ release.version }}. ## YJIT: New experimental in-process JIT compiler From 879ed2088c32fa8d6cd69712d99993124bb168bf Mon Sep 17 00:00:00 2001 From: jinroq <2787780+jinroq@users.noreply.github.com> Date: Sat, 27 Nov 2021 00:48:28 +0900 Subject: [PATCH 0078/1090] Revised the points pointed out in the review. --- ...ional-and-keyword-arguments-in-ruby-3-0.md | 34 ++++++++++--------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/ja/news/_posts/2019-12-12-separation-of-positional-and-keyword-arguments-in-ruby-3-0.md b/ja/news/_posts/2019-12-12-separation-of-positional-and-keyword-arguments-in-ruby-3-0.md index b9aec21a12..38c2aea1c9 100644 --- a/ja/news/_posts/2019-12-12-separation-of-positional-and-keyword-arguments-in-ruby-3-0.md +++ b/ja/news/_posts/2019-12-12-separation-of-positional-and-keyword-arguments-in-ruby-3-0.md @@ -11,7 +11,9 @@ lang: ja ## 概要 -Ruby 3.0では、位置引数とキーワード引数が分離されます。Ruby 3.0で変更される振る舞いはRuby 2.7でwarningを表示します。以下のいずれかのwarningが表示される場合は、コードのアップデートが必要です。 +この文書では便宜上、必須引数、オプション引数、rest引数、後置引数(つまり、キーワード引数とブロック引数以外の引数)をまとめて「位置引数」と呼びます。 + +Ruby 3.0では、位置引数とキーワード引数が分離されます。Ruby 3.0で変更される振る舞いはRuby 2.7で警告を表示します。以下のいずれかの警告が表示される場合は、コードのアップデートが必要です。 * `Using the last argument as keyword parameters is deprecated` * `Passing the keyword argument as the last hash parameter is deprecated` @@ -100,13 +102,13 @@ foo(k: 1) #=> {:k=>1} ## Q: 自分のコードはRuby 2.7で動かなくなりますか? -手短かに言うと「壊れない可能性はあります」。 +A: たぶん動きます。 -Ruby 2.7におけるこの変更は、3.0への移行パスとして設計されています。あくまで原則としてですが、Ruby 2.7ではRuby 3.0で変更される振る舞いについてwarningを出すにとどめており、warningの中には私たちが微細とみなしている変更点も若干含まれます。詳しくは後述の「その他の微細な変更点」をご覧ください。 +Ruby 2.7では、原則として、Ruby 3.0で変更される振る舞いについて警告を出すにとどめています。しかし、私たちが軽微とみなした非互換も少しだけ入っています。詳しくは後述の「その他の軽微な変更点」をご覧ください。 -Ruby 2.7では、warningが表示される点と微細な変更点以外を除いてRuby 2.6との互換性を保とうとしています。つまり、あなたのコードはRuby 2.7でもおそらく動作しますが、warningが表示される可能性はあります。あなたのコードをRuby 2.7で実行すれば、Ruby 3.0の準備ができているかどうかをチェックできます。 +Ruby 2.7では、警告が表示される点と軽微な変更点以外を除いてRuby 2.6との互換性を保とうとしています。つまり、あなたのコードはRuby 2.7でもおそらく動作しますが、警告が表示される可能性はあります。あなたのコードをRuby 2.7で実行すれば、Ruby 3.0の準備ができているかどうかをチェックできます。 -非推奨のwarningを無効にしたい場合は、コマンドライン引数`-W:no-deprecated`を使うか、コードに`Warning[:deprecated] = false`を追加します。 +非推奨の警告を無効にしたい場合は、コマンドライン引数`-W:no-deprecated`を使うか、コードに`Warning[:deprecated] = false`を追加します。 ## 引数の委譲の扱いについて @@ -162,7 +164,7 @@ ruby2_keywords def foo(*args, &block) end {% endhighlight %} -残念ながら、Ruby 2.6以前では新しい委譲スタイルを正しく扱えないため、旧来の委譲スタイル(`**kwargs`を使わないなど)を使う必要があります。これは、キーワード引数を分離した理由のひとつでもあります(詳しくは本記事末尾をご覧ください)。`ruby2_keywords`を用いれば、Ruby 2.7や3.0でも旧来の委譲スタイルを引き続き利用できます。2.6以前のRubyでは`ruby2_keywords`が定義されていないので、[ruby2_keywords](https://rubygems.org/gems/ruby2_keywords) gemを使うか、以下を手動で定義します。 +残念ながら、Ruby 2.6以前では新しい委譲スタイルを正しく扱えないため、旧来の委譲スタイル(つまり、**kwargsを受け渡ししないスタイル)を使う必要があります。これは、キーワード引数を分離した理由のひとつでもあります(詳しくは本記事末尾をご覧ください)。`ruby2_keywords`を用いれば、Ruby 2.7や3.0でも旧来の委譲スタイルを引き続き利用できます。2.6以前のRubyでは`ruby2_keywords`が定義されていないので、[ruby2_keywords](https://rubygems.org/gems/ruby2_keywords) gemを使うか、以下を手動で定義します。 {% highlight ruby %} def ruby2_keywords(*) @@ -186,15 +188,15 @@ foo({}) #=> Ruby 2.7: [] ({}を含んでいない) foo({}, **{}) #=> Ruby 2.7: [{}] ({}を渡せば、キーワード引数が「ない」ことを明示できる) {% endhighlight %} -上のコードでは、空のHash引数が自動的に変換されて`**kwargs`に吸い込まれ、この空のキーワードハッシュは委譲の呼び出しで削除されます。このため、`targe`には引数がまったく渡されなくなります。私たちが把握している範囲では、これが唯一のエッジケースです。 +上のコードでは、空のHash引数が自動的に変換されて`**kwargs`に吸い込まれ、この空のキーワードハッシュは委譲の呼び出しで削除されます。このため、`target`には引数がまったく渡されなくなります。私たちが把握している範囲では、これが唯一のエッジケースです。 上のコードの最下部に書いたように、`**{}`を渡すことでこの問題を回避できます。 -移植性がどうしても不安な場合は`ruby2_keywords`をお使いください(Ruby 2.6以前ではキーワード引数周りで膨大なエッジケースが存在していることを知っておいてください)。`ruby2_keywords`は、今後Ruby 2.6が役目を終えたときに削除される可能性があります。現時点で私たちがおすすめできるのは、キーワード引数を明示的に委譲することです(上述のRuby 3向けのコードを参照)。 +移植性がどうしても不安な場合は`ruby2_keywords`をお使いください(Ruby 2.6以前ではキーワード引数周りで膨大なエッジケースが存在していることを知っておいてください)。`ruby2_keywords`は、今後Ruby 2.6がサポート切れになったあとで削除される可能性があります。そのときになったら、キーワード引数を明示的に委譲することをおすすめします(上述のRuby 3向けのコードを参照)。 -## その他の微細な変更点 +## その他の軽微な変更点 -Ruby 2.7のキーワード引数では、この他に以下の3つのマイナーチェンジが行われています。 +Ruby 2.7のキーワード引数では、この他に以下の3つの軽微な変更が行われています。 ### 1\. キーワード引数で非シンボルキーを利用できるようになった @@ -256,7 +258,7 @@ foo(**empty_hash) なお、`foo(**{})`はRuby 2.6以前とRuby 2.7のどちらの場合も引数を渡さず、`**{}`がパーサーによって削除される点にご注意ください。また、Ruby 2.7以降ではどちらも`**empty_hash`として同じに扱われるので、メソッドにキーワード引数を渡さないようにする指定が楽に行なえます。 -Ruby 2.7では、あるメソッド呼び出しで必須とされる位置引数の個数が不足している場合、Ruby 2.6との互換性を保つために`foo(**empty_hash)`は空のハッシュを渡してwarningを表示します。この振る舞いはRuby 3.0で廃止されます。 +Ruby 2.7では、あるメソッド呼び出しで必須とされる位置引数の個数が不足している場合、Ruby 2.6との互換性を保つために`foo(**empty_hash)`は空のハッシュを渡して警告を表示します。この振る舞いはRuby 3.0で廃止されます。 {% highlight ruby %} def foo(x) @@ -273,7 +275,7 @@ foo(**empty_hash) ### 3\. キーワード引数を受け取らないことを表す構文(`**nil`)が導入される -メソッド定義で`**nil`を用いることで、そのメソッドがキーワード引数を受け取らないことを明示的に示せるようになります。このメソッドを呼び出すときにキーワード引数を渡すと`ArgumentError`が表示されます(これは非互換性ではなく、事実上新機能です)。 +メソッド定義で`**nil`を用いることで、そのメソッドがキーワード引数を受け取らないことを明示的に示せるようになります。このメソッドを呼び出すときにキーワード引数を渡すと`ArgumentError`が表示されます(これは非互換性ではなく、新機能です)。 {% highlight ruby %} def foo(*args, **nil) @@ -283,7 +285,7 @@ foo(k: 1) #=> Ruby 2.7以降: no keywords accepted (ArgumentError) {% endhighlight %} -この新構文は、メソッドがキーワード引数を受け取らないことを明示的に指定するのに有用です。これを使わない場合、キーワード引数は上述の例の他の引数に吸い込まれます。メソッドを拡張してキーワード引数を受け取るようにする場合、以下のような非互換性が発生する可能性があります。 +この新構文は、メソッドがキーワード引数を受け取らないことを明示的に指定するのに有用です。これを使わない場合、キーワード引数は上述の例のrest引数に吸い込まれます。メソッドを拡張してキーワード引数を受け取るようにする場合、以下のような非互換性が発生する可能性があります。 {% highlight ruby %} # メソッドは残りの引数を受け取るが、`**nil`はない状態 @@ -307,7 +309,7 @@ foo(k: 1) #=> ArgumentError: unknown keyword k 当初、自動変換はうまいアイデアに思われていて、多くの場合問題なく機能していました。しかし、エッジケースがあまりにも多く、これまでこの振る舞いに関するバグレポートを山のように受け取りました。 -自動変換は、オプションの位置引数とキーワード引数をどちらも受け取るメソッドではうまく動きません。末尾のHashオブジェクトを位置引数として扱うことを期待する人々もいれば、末尾のHashオブジェクトをキーワード引数として扱うことを期待する人々もいました。 +自動変換は、オプション引数とキーワード引数をどちらも受け取るメソッドではうまく動きません。末尾のHashオブジェクトを位置引数として扱うことを期待する人々もいれば、末尾のHashオブジェクトをキーワード引数として扱うことを期待する人々もいました。 最も混乱を呼ぶケースのひとつを以下に示します。 @@ -345,7 +347,7 @@ foo() #=> Ruby 2.6以前: [{}] #=> Ruby 2.7以降: [] {% endhighlight %} -`foo()`には引数がありませんが、Ruby 2.6では空のハッシュ引数が`target`に渡されます。理由は、メソッド`foo`が明示的にキーワード(`**kwargs`)を委譲しているためです。`foo()`が呼び出されると、`args`は空のArrayになり、`kwargs`は空のHashになります。そして`target(*args, **kwargs, &block)`は空のHashを引数として1つ渡します。理由は、`**kwargs`が自動的にHash位置引数に変換されるためです。 +`foo()`には引数がありませんが、Ruby 2.6では空のハッシュ引数が`target`に渡されます。理由は、メソッド`foo`が明示的にキーワード(`**kwargs`)を委譲しているためです。`foo()`が呼び出されると、`args`は空のArrayになり、`kwargs`は空のHashになり、blockはnilになります。。そして`target(*args, **kwargs, &block)`は空のHashを引数として1つ渡します。理由は、`**kwargs`が自動的にHash位置引数に変換されるためです。 自動変換は開発者を混乱させるのみならず、メソッドの拡張性も弱めてしまいます。振る舞いが変更された理由や、特定の実装が選択された理由について詳しくは[Feature #14183](https://bugs.ruby-lang.org/issues/14183)をご覧ください。 @@ -355,4 +357,4 @@ foo() #=> Ruby 2.6以前: [{}] ## 更新履歴 -* 更新 2019-12-25: 2.7.0-rc2でwarningメッセージが若干変更され、warning抑制APIが追加された。 +* 更新 2019-12-25: 2.7.0-rc2で警告メッセージが若干変更され、警告抑制APIが追加された。 From 6d63b42335fa7eb881aa16c65d0b5f1756f0e269 Mon Sep 17 00:00:00 2001 From: hachi8833 Date: Wed, 22 Jan 2020 12:35:17 +0900 Subject: [PATCH 0079/1090] Add en doc --- ...ional-and-keyword-arguments-in-ruby-3-0.md | 355 ++++++++++++++++++ 1 file changed, 355 insertions(+) create mode 100644 ja/news/_posts/2019-12-12-separation-of-positional-and-keyword-arguments-in-ruby-3-0.md diff --git a/ja/news/_posts/2019-12-12-separation-of-positional-and-keyword-arguments-in-ruby-3-0.md b/ja/news/_posts/2019-12-12-separation-of-positional-and-keyword-arguments-in-ruby-3-0.md new file mode 100644 index 0000000000..44cd874cc1 --- /dev/null +++ b/ja/news/_posts/2019-12-12-separation-of-positional-and-keyword-arguments-in-ruby-3-0.md @@ -0,0 +1,355 @@ +--- +layout: news_post +title: "Separation of positional and keyword arguments in Ruby 3.0" +author: "mame" +translator: +date: 2019-12-12 12:00:00 +0000 +lang: en +--- + +This article explains the planned incompatibility of keyword arguments in Ruby 3.0 + +## tl;dr + +In Ruby 3.0, positional arguments and keyword arguments will be separated. Ruby 2.7 will warn for behaviors that will change in Ruby 3.0. If you see the following warnings, you need to update your code: + +* `Using the last argument as keyword parameters is deprecated`, or +* `Passing the keyword argument as the last hash parameter is deprecated`, or +* `Splitting the last argument into positional and keyword parameters is deprecated` + +In most cases, you can avoid the incompatibility by adding the _double splat_ operator. It explicitly specifies passing keyword arguments instead of a `Hash` object. Likewise, you may add braces `{}` to explicitly pass a `Hash` object, instead of keyword arguments. Read the section "Typical cases" below for more details. + +In Ruby 3, a method delegating all arguments must explicitly delegate keyword arguments in addition to positional arguments. If you want to keep the delegation behavior found in Ruby 2.7 and earlier, use `ruby2_keywords`. See the "Handling argument delegation" section below for more details. + +## Typical cases + +Here is the most typical case. You can use double splat operator (`**`) to pass keywords instead of a Hash. + +{% highlight ruby %} +# This method accepts only a keyword argument +def foo(k: 1) + p k +end + +h = { k: 42 } + +# This method call passes a positional Hash argument +# In Ruby 2.7: The Hash is automatically converted to a keyword argument +# In Ruby 3.0: This call raises an ArgumentError +foo(h) + # => demo.rb:11: warning: Using the last argument as keyword parameters is deprecated; maybe ** should be added to the call + # demo.rb:2: warning: The called method `foo' is defined here + # 42 + +# If you want to keep the behavior in Ruby 3.0, use double splat +foo(**h) #=> 42 +{% endhighlight %} + +Here is another case. You can use braces (`{}`) to pass a Hash instead of keywords explicitly. + +{% highlight ruby %} +# This method accepts one positional argument and a keyword rest argument +def bar(h, **kwargs) + p h +end + +# This call passes only a keyword argument and no positional arguments +# In Ruby 2.7: The keyword is converted to a positional Hash argument +# In Ruby 3.0: This call raises an ArgumentError +bar(k: 42) + # => demo2.rb:9: warning: Passing the keyword argument as the last hash parameter is deprecated + # demo2.rb:2: warning: The called method `bar' is defined here + # {:k=>42} + +# If you want to keep the behavior in Ruby 3.0, write braces to make it an +# explicit Hash +bar({ k: 42 }) # => {:k=>42} +{% endhighlight %} + +## What is deprecated? + +In Ruby 2, keyword arguments can be treated as the last positional Hash argument and a last positional Hash argument can be treated as keyword arguments. + +Because the automatic conversion is sometimes too complex and troublesome as described in the final section. So it's now deprecated in Ruby 2.7 and will be removed in Ruby 3. In other words, keyword arguments will be completely separated from positional one in Ruby 3. So when you want to pass keyword arguments, you should always use `foo(k: expr)` or `foo(**expr)`. If you want to accept keyword arguments, in principle you should always use `def foo(k: default)` or `def foo(k:)` or `def foo(**kwargs)`. + +Note that Ruby 3.0 doesn't behave differently when calling a method which doesn't accept keyword arguments with keyword arguments. For instance, the following case is not going to be deprecated and will keep working in Ruby 3.0. The keyword arguments are still treated as a positional Hash argument. + +{% highlight ruby %} +def foo(kwargs = {}) + kwargs +end + +foo(k: 1) #=> {:k=>1} +{% endhighlight %} + +This is because this style is used very frequently, and there is no ambiguity in how the argument should be treated. Prohibiting this conversion would result in additional incompatibility for little benefit. + +However, this style is not recommended in new code, unless you are often passing a Hash as a positional argument, and are also using keyword arguments. Otherwise, use double splat: + +{% highlight ruby %} +def foo(**kwargs) + kwargs +end + +foo(k: 1) #=> {:k=>1} +{% endhighlight %} + +## Will my code break on Ruby 2.7? + +A short answer is "maybe not". + +The changes in Ruby 2.7 are designed as a migration path towards 3.0. While in principle, Ruby 2.7 only warns against behaviors that will change in Ruby 3, it includes some incompatible changes we consider to be minor. See the "Other minor changes" section for details. + +Except for the warnings and minor changes, Ruby 2.7 attempts to keep the compatibility with Ruby 2.6. So, your code will probably work on Ruby 2.7, though it may emit warnings. And by running it on Ruby 2.7, you can check if your code is ready for Ruby 3.0. + +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. + +## Handling argument delegation + +### Ruby 2.6 or prior + +In Ruby 2, you can write a delegation method by accepting a `*rest` argument and a `&block` argument, and passing the two to the target method. In this behavior, the keyword arguments are also implicitly handled by the automatic conversion between positional and keyword arguments. + +{% highlight ruby %} +def foo(*args, &block) + target(*args, &block) +end +{% endhighlight %} + +### Ruby 3 + +You need to explicitly delegate keyword arguments. + +{% highlight ruby %} +def foo(*args, **kwargs, &block) + target(*args, **kwargs, &block) +end +{% endhighlight %} + +Alternatively, if you do not need compatibility with Ruby 2.6 or prior and you don't alter any arguments, you can use the new delegation syntax (`...`) that is introduced in Ruby 2.7. + +{% highlight ruby %} +def foo(...) + target(...) +end +{% endhighlight %} + +### Ruby 2.7 + +In short: use `Module#ruby2_keywords` and delegate `*args, &block`. + +{% highlight ruby %} +ruby2_keywords def foo(*args, &block) + target(*args, &block) +end +{% endhighlight %} + +`ruby2_keywords` accepts keyword arguments as the last Hash argument, and passes it as keyword arguments when calling the other method. + +In fact, Ruby 2.7 allows the new style of delegation in many cases. However, there is a known corner case. See the next section. + +### A compatible delegation that works on Ruby 2.6, 2.7 and Ruby 3 + +In short: use `Module#ruby2_keywords` again. + +{% highlight ruby %} +ruby2_keywords def foo(*args, &block) + target(*args, &block) +end +{% endhighlight %} + +Unfortunately, we need to use the old-style delegation (i.e., no `**kwargs`) because Ruby 2.6 or prior does not handle the new delegation style correctly. This is one of the reasons of the keyword argument separation; the details are described in the final section. And `ruby2_keywords` allows you to run the old style even in Ruby 2.7 and 3.0. As there is no `ruby2_keywords` defined in 2.6 or prior, please use the [ruby2_keywords gem](https://rubygems.org/gems/ruby2_keywords) or define it yourself: + +{% highlight ruby %} +def ruby2_keywords(*) +end if RUBY_VERSION < "2.7" +{% endhighlight %} + +--- + +If your code doesn't have to run on Ruby 2.6 or older, you may try the new style in Ruby 2.7. In almost all cases, it works. Note that, however, there are unfortunate corner cases as follows: + +{% highlight ruby %} +def target(*args) + p args +end + +def foo(*args, **kwargs, &block) + target(*args, **kwargs, &block) +end + +foo({}) #=> Ruby 2.7: [] ({} is dropped) +foo({}, **{}) #=> Ruby 2.7: [{}] (You can pass {} by explicitly passing "no" keywords) +{% endhighlight %} + +An empty Hash argument is automatically converted and absorbed into `**kwargs`, and the delegation call removes the empty keyword hash, so no argument is passed to `target`. As far as we know, this is the only corner case. + +As noted in the last line, you can work around this issue by using `**{}`. + +If you really worry about the portability, use `ruby2_keywords`. (Acknowledge that Ruby 2.6 or before themselves have tons of corner cases in keyword arguments. :-) +`ruby2_keywords` might be removed in the future after Ruby 2.6 reaches end-of-life. At that point, we recommend to explicitly delegate keyword arguments (see Ruby 3 code above). + +## Other minor changes + +There are three minor changes about keyword arguments in Ruby 2.7. + +### 1. Non-Symbol keys are allowed in keyword arguments + +In Ruby 2.6 or before, only Symbol keys were allowed in keyword arguments. In Ruby 2.7, keyword arguments can use non-Symbol keys. + +{% highlight ruby %} +def foo(**kwargs) + kwargs +end +foo("key" => 42) + #=> Ruby 2.6 or before: ArgumentError: wrong number of arguments + #=> Ruby 2.7 or later: {"key"=>42} +{% endhighlight %} + +If a method accepts both optional and keyword arguments, the Hash object that has both Symbol keys and non-Symbol keys was split in two in Ruby 2.6. In Ruby 2.7, both are accepted as keywords because non-Symbol keys are allowed. + +{% highlight ruby %} +def bar(x=1, **kwargs) + p [x, kwargs] +end + +bar("key" => 42, :sym => 43) + #=> Ruby 2.6: [{"key"=>42}, {:sym=>43}] + #=> Ruby 2.7: [1, {"key"=>42, :sym=>43}] + +# Use braces to keep the behavior +bar({"key" => 42}, :sym => 43) + #=> Ruby 2.6 and 2.7: [{"key"=>42}, {:sym=>43}] +{% endhighlight %} + +Ruby 2.7 still splits hashes with a warning if passing a Hash or keyword arguments with both Symbol and non-Symbol keys to a method that accepts explicit keywords but no keyword rest argument (`**kwargs`). This behavior will be removed in Ruby 3, and an `ArgumentError` will be raised. + +{% highlight ruby %} +def bar(x=1, sym: nil) + p [x, sym] +end + +bar("key" => 42, :sym => 43) +# Ruby 2.6 and 2.7: => [{"key"=>42}, 43] +# Ruby 2.7: warning: Splitting the last argument into positional and keyword parameters is deprecated +# warning: The called method `bar' is defined here +# Ruby 3.0: ArgumentError +{% endhighlight %} + +### 2. Double splat with an empty hash (`**{}`) passes no arguments + +In Ruby 2.6 or before, passing `**empty_hash` passes an empty Hash as a positional argument. In Ruby 2.7 or later, it passes no arguments. + +{% highlight ruby %} +def foo(*args) + args +end + +empty_hash = {} +foo(**empty_hash) + #=> Ruby 2.6 or before: [{}] + #=> Ruby 2.7 or later: [] +{% endhighlight %} + +Note that `foo(**{})` passes nothing in both Ruby 2.6 and 2.7. In Ruby 2.6 and before, `**{}` is removed by the parser, and in Ruby 2.7 and above, it is treated the same as `**empty_hash`, allowing for an easy way to pass no keyword arguments to a method. + +In Ruby 2.7, when calling a method with an insufficient number of required positional arguments, `foo(**empty_hash)` passes an empty hash with a warning emitted, for compatibility with Ruby 2.6. This behavior will be removed in 3.0. + +{% highlight ruby %} +def foo(x) + x +end + +empty_hash = {} +foo(**empty_hash) + #=> Ruby 2.6 or before: {} + #=> Ruby 2.7: warning: Passing the keyword argument as the last hash parameter is deprecated + # warning: The called method `foo' is defined here + #=> Ruby 3.0: ArgumentError: wrong number of arguments +{% endhighlight %} + +### 3. The no-keyword-arguments syntax (`**nil`) is introduced + +You can use `**nil` in a method definition to explicitly mark the method accepts no keyword arguments. Calling such methods with keyword arguments will result in an `ArgumentError`. (This is actually a new feature, not an incompatibility) + +{% highlight ruby %} +def foo(*args, **nil) +end + +foo(k: 1) + #=> Ruby 2.7 or later: no keywords accepted (ArgumentError) +{% endhighlight %} + +This is useful to make it explicit that the method does not accept keyword arguments. Otherwise, the keywords are absorbed in the rest argument in the above example. If you extend a method to accept keyword arguments, the method may have incompatibility as follows: + +{% highlight ruby %} +# If a method accepts rest argument and no `**nil` +def foo(*args) + p args +end + +# Passing keywords are converted to a Hash object (even in Ruby 3.0) +foo(k: 1) #=> [{:k=>1}] + +# If the method is extended to accept a keyword +def foo(*args, mode: false) + p args +end + +# The existing call may break +foo(k: 1) #=> ArgumentError: unknown keyword k +{% endhighlight %} + +## Why we're deprecating the automatic conversion + +The automatic conversion initially appeared to be a good idea, and worked well in many cases. However, it had too many corner cases, and we have received many bug reports about the behavior. + +Automatic conversion does not work well when a method accepts optional positional arguments and keyword arguments. Some people expect the last Hash object to be treated as a positional argument, and others expect it to be converted to keyword arguments. + +Here is one of the most confusing cases: + +{% highlight ruby %} +def foo(x, **kwargs) + p [x, kwargs] +end + +def bar(x=1, **kwargs) + p [x, kwargs] +end + +foo({}) => [{}, {}] +bar({}) => [1, {}] + +bar({}, **{}) => expected: [{}, {}], actual: [1, {}] +{% endhighlight %} + +In Ruby 2, `foo({})` passes an empty hash as a normal argument (i.e., `{}` is assigned to `x`), while `bar({})` passes a keyword argument (i.e, `{}` is assigned to `kwargs`). So `any_method({})` is very ambiguous. + +You may think of `bar({}, **{})` to pass the empty hash to `x` explicitly. Surprisingly, it does not work as you expected; it still prints `[1, {}]` in Ruby 2.6. This is because `**{}` is ignored by the parser in Ruby 2.6, and the first argument `{}` is automatically converted to keywords (`**kwargs`). In this case, you need to call `bar({}, {})`, which is very weird. + +The same issues also apply to methods that accept rest and keyword arguments. This makes explicit delegation of keyword arguments not work. + +{% highlight ruby %} +def target(*args) + p args +end + +def foo(*args, **kwargs, &block) + target(*args, **kwargs, &block) +end + +foo() #=> Ruby 2.6 or before: [{}] + #=> Ruby 2.7 or later: [] +{% endhighlight %} + +`foo()` passes no arguments, but `target` receives an empty hash argument in Ruby 2.6. This is because the method `foo` delegates keywords (`**kwargs`) explicitly. When `foo()` is called, `args` is an empty Array, `kwargs` is an empty Hash, and `block` is `nil`. And then `target(*args, **kwargs, &block)` passes an empty Hash as an argument because `**kwargs` is automatically converted to a positional Hash argument. + +The automatic conversion not only confuses people but also makes the method less extensible. See [[Feature #14183]](https://bugs.ruby-lang.org/issues/14183) for more details about the reasons for the change in behavior, and why certain implementation choices were made. + +## Acknowledgment + +This article was kindly reviewed (or even co-authored) by Jeremy Evans and Benoit Daloze. + +## History + +* Updated 2019-12-25: In 2.7.0-rc2, the warning message was slightly changed, and an API to suppress the warnings was added. From f93cd654bd38b0e17b278ddd81087a1f1ba65a72 Mon Sep 17 00:00:00 2001 From: hachi8833 Date: Wed, 22 Jan 2020 12:35:47 +0900 Subject: [PATCH 0080/1090] Translate "Separation of positional and keyword arguments in Ruby 3.0" --- ...ional-and-keyword-arguments-in-ruby-3-0.md | 195 +++++++++--------- 1 file changed, 99 insertions(+), 96 deletions(-) diff --git a/ja/news/_posts/2019-12-12-separation-of-positional-and-keyword-arguments-in-ruby-3-0.md b/ja/news/_posts/2019-12-12-separation-of-positional-and-keyword-arguments-in-ruby-3-0.md index 44cd874cc1..5e80e231d5 100644 --- a/ja/news/_posts/2019-12-12-separation-of-positional-and-keyword-arguments-in-ruby-3-0.md +++ b/ja/news/_posts/2019-12-12-separation-of-positional-and-keyword-arguments-in-ruby-3-0.md @@ -2,77 +2,81 @@ layout: news_post title: "Separation of positional and keyword arguments in Ruby 3.0" author: "mame" -translator: +translator: "hachi8833" date: 2019-12-12 12:00:00 +0000 -lang: en +lang: ja --- -This article explains the planned incompatibility of keyword arguments in Ruby 3.0 +本記事では、Ruby 3.0で予定されているキーワード引数の非互換性について解説します。 -## tl;dr +## 概要 -In Ruby 3.0, positional arguments and keyword arguments will be separated. Ruby 2.7 will warn for behaviors that will change in Ruby 3.0. If you see the following warnings, you need to update your code: +Ruby 3.0では、位置引数とキーワード引数が分離されます。Ruby 3.0で変更される振る舞いはRuby 2.7でwarningを表示します。以下のいずれかのwarningが表示される場合は、コードのアップデートが必要です。 * `Using the last argument as keyword parameters is deprecated`, or * `Passing the keyword argument as the last hash parameter is deprecated`, or * `Splitting the last argument into positional and keyword parameters is deprecated` -In most cases, you can avoid the incompatibility by adding the _double splat_ operator. It explicitly specifies passing keyword arguments instead of a `Hash` object. Likewise, you may add braces `{}` to explicitly pass a `Hash` object, instead of keyword arguments. Read the section "Typical cases" below for more details. +この非互換性は、double splat演算子(`**`)を追加することでほぼ回避できます。これにより、`Hash`オブジェクトではなくキーワード引数を渡すことが明示的に指定されます。同様に、キーワード引数ではなく`Hash`オブジェクトを明示的に渡したい場合は中かっこ(`{}`)を追加できます。詳しくは後述の「典型的なケース」をご覧ください。 -In Ruby 3, a method delegating all arguments must explicitly delegate keyword arguments in addition to positional arguments. If you want to keep the delegation behavior found in Ruby 2.7 and earlier, use `ruby2_keywords`. See the "Handling argument delegation" section below for more details. +Ruby 3では、すべての引数を委譲するメソッドで、位置引数の他に必ずキーワード引数も明示的に委譲しなければなりません。Ruby 2.7以前の委譲の振る舞いを変えたくない場合は、`ruby2_keywords`をお使いください。詳しくは後述の「引数の委譲の扱いについて」をご覧ください。 -## Typical cases +## よくあるケース -Here is the most typical case. You can use double splat operator (`**`) to pass keywords instead of a Hash. +以下はもっともよくあるケースです。Hashではなくキーワードを渡すのにdouble splat演算子(`**`)を使えます。 {% highlight ruby %} -# This method accepts only a keyword argument +# このメソッドはキーワード引数のみを受け取る def foo(k: 1) p k end h = { k: 42 } -# This method call passes a positional Hash argument -# In Ruby 2.7: The Hash is automatically converted to a keyword argument -# In Ruby 3.0: This call raises an ArgumentError +# このメソッド呼び出しは位置引数としてHashを渡している +# Ruby 2.7: このHashは自動でキーワード引数に変換される +# Ruby 3.0: この呼び出しはArgumentErrorになる foo(h) # => demo.rb:11: warning: Using the last argument as keyword parameters is deprecated; maybe ** should be added to the call # demo.rb:2: warning: The called method `foo' is defined here # 42 -# If you want to keep the behavior in Ruby 3.0, use double splat +# この振る舞いをRuby 3.0で変えたくない場合はdouble splatを用いる foo(**h) #=> 42 {% endhighlight %} -Here is another case. You can use braces (`{}`) to pass a Hash instead of keywords explicitly. +別の例: キーワード引数ではなくHashを明示的に渡す場合は中かっこ(`{}`)を使います。 {% highlight ruby %} -# This method accepts one positional argument and a keyword rest argument +# このメソッドは位置引数を1個、残りはキーワード引数を受け取る def bar(h, **kwargs) p h end -# This call passes only a keyword argument and no positional arguments -# In Ruby 2.7: The keyword is converted to a positional Hash argument -# In Ruby 3.0: This call raises an ArgumentError +# この呼び出しではキーワード引数のみが渡され、位置引数は渡されない +# Ruby 2.7: このキーワード引数は自動でHash引数に変換される +# Ruby 3.0: この呼び出しはArgumentErrorになる bar(k: 42) # => demo2.rb:9: warning: Passing the keyword argument as the last hash parameter is deprecated # demo2.rb:2: warning: The called method `bar' is defined here # {:k=>42} -# If you want to keep the behavior in Ruby 3.0, write braces to make it an -# explicit Hash +# この振る舞いをRuby 3.0で変えたくない場合は +# 中かっこで明示的にHashにする bar({ k: 42 }) # => {:k=>42} {% endhighlight %} -## What is deprecated? +## どの動作が非推奨になるか -In Ruby 2, keyword arguments can be treated as the last positional Hash argument and a last positional Hash argument can be treated as keyword arguments. +Ruby 2では、キーワード引数が末尾のハッシュ位置引数として扱われることがあります。また、末尾のハッシュ引数がキーワード引数として扱われることもあります。 -Because the automatic conversion is sometimes too complex and troublesome as described in the final section. So it's now deprecated in Ruby 2.7 and will be removed in Ruby 3. In other words, keyword arguments will be completely separated from positional one in Ruby 3. So when you want to pass keyword arguments, you should always use `foo(k: expr)` or `foo(**expr)`. If you want to accept keyword arguments, in principle you should always use `def foo(k: default)` or `def foo(k:)` or `def foo(**kwargs)`. +この自動変換は場合によっては複雑になりすぎてしまい、本記事末尾で後述するようにトラブルの原因になることがあります。そのため、この自動変換をRuby 2.7で非推奨とし、Ruby 3.0で廃止する予定です。言い換えると、Ruby 3.0のキーワード引数は位置引数と完全に分離されることになります。つまり、キーワード引数を渡したい場合は、常に`foo(k: expr)`または`foo(**expr)`の形にすべきです。(メソッド定義で)キーワード引数を受け取りたい場合は、原則として常に以下のいずれかの形にすべきです。 -Note that Ruby 3.0 doesn't behave differently when calling a method which doesn't accept keyword arguments with keyword arguments. For instance, the following case is not going to be deprecated and will keep working in Ruby 3.0. The keyword arguments are still treated as a positional Hash argument. +* `def foo(k: default)` +* `def foo(k:)` +* `def foo(**kwargs)` + +なお、キーワード引数を受け取らないメソッドを呼び出すときにキーワード引数を渡した場合の振る舞いは、Ruby 3.0でも変わらない点にご注意ください。たとえば、以下のケースは非推奨にはならず、Ruby 3.0でも引き続き動作します(このキーワード引数は引き続きHash位置引数として扱われます)。 {% highlight ruby %} def foo(kwargs = {}) @@ -82,9 +86,9 @@ end foo(k: 1) #=> {:k=>1} {% endhighlight %} -This is because this style is used very frequently, and there is no ambiguity in how the argument should be treated. Prohibiting this conversion would result in additional incompatibility for little benefit. +変わらない理由は、このスタイルが非常によく用いられていることと、この呼び出し方法では引数の扱いに曖昧な点がないためです。この振る舞いまで禁止してしまうと、得られるメリットが少ないうえに非互換性がさらに増えてしまいます。 -However, this style is not recommended in new code, unless you are often passing a Hash as a positional argument, and are also using keyword arguments. Otherwise, use double splat: +ただし今後新しいコードを書く場合、このスタイルはおすすめできません(Hashを位置引数として渡す頻度が高く、かつキーワード引数も使う場合を除く)。代わりに、次のようにdouble splat(`**`)をお使いください。 {% highlight ruby %} def foo(**kwargs) @@ -94,21 +98,21 @@ end foo(k: 1) #=> {:k=>1} {% endhighlight %} -## Will my code break on Ruby 2.7? +## Q: 自分のコードはRuby 2.7で動かなくなりますか? -A short answer is "maybe not". +手短かに言うと「壊れない可能性はあります」。 -The changes in Ruby 2.7 are designed as a migration path towards 3.0. While in principle, Ruby 2.7 only warns against behaviors that will change in Ruby 3, it includes some incompatible changes we consider to be minor. See the "Other minor changes" section for details. +Ruby 2.7におけるこの変更は、3.0への移行パスとして設計されています。あくまで原則としてですが、Ruby 2.7ではRuby 3.0で変更される振る舞いについてwarningを出すにとどめており、warningの中には私たちが微細とみなしている変更点も若干含まれます。詳しくは後述の「その他の微細な変更点」をご覧ください。 -Except for the warnings and minor changes, Ruby 2.7 attempts to keep the compatibility with Ruby 2.6. So, your code will probably work on Ruby 2.7, though it may emit warnings. And by running it on Ruby 2.7, you can check if your code is ready for Ruby 3.0. +Ruby 2.7では、warningが表示される点と微細な変更点以外を除いてRuby 2.6との互換性を保とうとしています。つまり、あなたのコードはRuby 2.7でもおそらく動作しますが、warningが表示される可能性はあります。あなたのコードをRuby 2.7で実行すれば、Ruby 3.0の準備ができているかどうかをチェックできます。 -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. +非推奨のwarningを無効にしたい場合は、コマンドライン引数`-W:no-deprecated`を使うか、コードに`Warning[:deprecated] = false`を追加します。 -## Handling argument delegation +## 引数の委譲の扱いについて -### Ruby 2.6 or prior +### Ruby 2.6以前の場合 -In Ruby 2, you can write a delegation method by accepting a `*rest` argument and a `&block` argument, and passing the two to the target method. In this behavior, the keyword arguments are also implicitly handled by the automatic conversion between positional and keyword arguments. +Ruby 2では、以下のように1個の`*rest`引数と1個の`&block`引数を受け付けて、この2つの引数を委譲先メソッド(以下の`target`)に渡すことで委譲メソッドを書けます。この振る舞いでは、(1つ以上の)キーワード引数も「位置引数<=>キーワード引数の自動変換」によって暗黙的に扱われます。 {% highlight ruby %} def foo(*args, &block) @@ -116,9 +120,9 @@ def foo(*args, &block) end {% endhighlight %} -### Ruby 3 +### Ruby 3の場合 -You need to explicitly delegate keyword arguments. +以下のようにキーワード引数を明示的に委譲する必要があります。 {% highlight ruby %} def foo(*args, **kwargs, &block) @@ -126,7 +130,7 @@ def foo(*args, **kwargs, &block) end {% endhighlight %} -Alternatively, if you do not need compatibility with Ruby 2.6 or prior and you don't alter any arguments, you can use the new delegation syntax (`...`) that is introduced in Ruby 2.7. +別の方法として、Ruby 2.6以前との互換性を考慮する必要がなく、かつ引数を一切改変しないのであれば、以下のようにRuby 2.7で新しく導入される委譲構文(`...`)を利用できます。 {% highlight ruby %} def foo(...) @@ -134,9 +138,9 @@ def foo(...) end {% endhighlight %} -### Ruby 2.7 +### Ruby 2.7の場合 -In short: use `Module#ruby2_keywords` and delegate `*args, &block`. +手短かに言うと、以下のように`Module#ruby2_keywords`を用い、`*args, &block`を委譲します。 {% highlight ruby %} ruby2_keywords def foo(*args, &block) @@ -144,13 +148,13 @@ ruby2_keywords def foo(*args, &block) end {% endhighlight %} -`ruby2_keywords` accepts keyword arguments as the last Hash argument, and passes it as keyword arguments when calling the other method. +`ruby2_keywords`を指定すると、キーワード引数を末尾のHash引数として受け取れるようになり、他のメソッドを呼び出すときにそれをキーワード引数として渡せます。 -In fact, Ruby 2.7 allows the new style of delegation in many cases. However, there is a known corner case. See the next section. +実際、Ruby 2.7では多くの場面でこの新しい委譲のスタイルを利用できます。ただし1つ既知のエッジケースがあります。次をご覧ください。 -### A compatible delegation that works on Ruby 2.6, 2.7 and Ruby 3 +### Ruby 2.6 / 2.7 / 3で互換性のある委譲スタイル -In short: use `Module#ruby2_keywords` again. +手短かに言うと、ここも「`Module#ruby2_keywords`を使う」となります。 {% highlight ruby %} ruby2_keywords def foo(*args, &block) @@ -158,16 +162,16 @@ ruby2_keywords def foo(*args, &block) end {% endhighlight %} -Unfortunately, we need to use the old-style delegation (i.e., no `**kwargs`) because Ruby 2.6 or prior does not handle the new delegation style correctly. This is one of the reasons of the keyword argument separation; the details are described in the final section. And `ruby2_keywords` allows you to run the old style even in Ruby 2.7 and 3.0. As there is no `ruby2_keywords` defined in 2.6 or prior, please use the [ruby2_keywords gem](https://rubygems.org/gems/ruby2_keywords) or define it yourself: +残念ながら、Ruby 2.6以前では新しい委譲スタイルを正しく扱えないため、旧来の委譲スタイル(`**kwargs`を使わないなど)を使う必要があります。これは、キーワード引数を分離した理由のひとつでもあります(詳しくは本記事末尾をご覧ください)。`ruby2_keywords`を用いれば、Ruby 2.7や3.0でも旧来の委譲スタイルを引き続き利用できます。2.6以前のRubyでは`ruby2_keywords`が定義されていないので、[ruby2_keywords](https://rubygems.org/gems/ruby2_keywords) gemを使うか、以下を手動で定義します。 {% highlight ruby %} def ruby2_keywords(*) end if RUBY_VERSION < "2.7" {% endhighlight %} ---- +* * * * * -If your code doesn't have to run on Ruby 2.6 or older, you may try the new style in Ruby 2.7. In almost all cases, it works. Note that, however, there are unfortunate corner cases as follows: +自分のコードがRuby 2.6以前で動かなくても構わないのであれば、Ruby 2.7で新しいスタイルを試してもよいでしょう。ほぼほぼ間違いなく動作しますが、以下のようなエッジケースを運悪く踏むこともあります。 {% highlight ruby %} def target(*args) @@ -178,35 +182,34 @@ def foo(*args, **kwargs, &block) target(*args, **kwargs, &block) end -foo({}) #=> Ruby 2.7: [] ({} is dropped) -foo({}, **{}) #=> Ruby 2.7: [{}] (You can pass {} by explicitly passing "no" keywords) +foo({}) #=> Ruby 2.7: [] ({}を含んでいない) +foo({}, **{}) #=> Ruby 2.7: [{}] ({}を渡せば、キーワード引数が「ない」ことを明示できる) {% endhighlight %} -An empty Hash argument is automatically converted and absorbed into `**kwargs`, and the delegation call removes the empty keyword hash, so no argument is passed to `target`. As far as we know, this is the only corner case. +上のコードでは、空のHash引数が自動的に変換されて`**kwargs`に吸い込まれ、この空のキーワードハッシュは委譲の呼び出しで削除されます。このため、`targe`には引数がまったく渡されなくなります。私たちが把握している範囲では、これが唯一のエッジケースです。 -As noted in the last line, you can work around this issue by using `**{}`. +上のコードの最下部に書いたように、`**{}`を渡すことでこの問題を回避できます。 -If you really worry about the portability, use `ruby2_keywords`. (Acknowledge that Ruby 2.6 or before themselves have tons of corner cases in keyword arguments. :-) -`ruby2_keywords` might be removed in the future after Ruby 2.6 reaches end-of-life. At that point, we recommend to explicitly delegate keyword arguments (see Ruby 3 code above). +移植性がどうしても不安な場合は`ruby2_keywords`をお使いください(Ruby 2.6以前ではキーワード引数周りで膨大なエッジケースが存在していることを知っておいてください)。`ruby2_keywords`は、今後Ruby 2.6が役目を終えたときに削除される可能性があります。現時点で私たちがおすすめできるのは、キーワード引数を明示的に委譲することです(上述のRuby 3向けのコードを参照)。 -## Other minor changes +## その他の微細な変更点 -There are three minor changes about keyword arguments in Ruby 2.7. +Ruby 2.7のキーワード引数では、この他に以下の3つのマイナーチェンジが行われています。 -### 1. Non-Symbol keys are allowed in keyword arguments +### 1\. キーワード引数で非シンボルキーを利用できるようになった -In Ruby 2.6 or before, only Symbol keys were allowed in keyword arguments. In Ruby 2.7, keyword arguments can use non-Symbol keys. +Ruby 2.6以前のキーワード引数では、シンボル形式のキーしか利用できませんでした。Ruby 2.7のキーワード引数では、以下のようにシンボル形式でないキーを利用できるようになります。 {% highlight ruby %} def foo(**kwargs) kwargs end foo("key" => 42) - #=> Ruby 2.6 or before: ArgumentError: wrong number of arguments - #=> Ruby 2.7 or later: {"key"=>42} + #=> Ruby 2.6以前: ArgumentError: wrong number of arguments + #=> Ruby 2.7以降: {"key"=>42} {% endhighlight %} -If a method accepts both optional and keyword arguments, the Hash object that has both Symbol keys and non-Symbol keys was split in two in Ruby 2.6. In Ruby 2.7, both are accepted as keywords because non-Symbol keys are allowed. +あるメソッドがオプション引数とキーワード引数を両方とも受け付ける場合、Ruby 2.6では以下のようにシンボル形式のキーと非シンボルキーを両方持つHashオブジェクトが2つに分割されていました。Ruby 2.7では非シンボルキーを利用できるので、どちらも受け取れます。 {% highlight ruby %} def bar(x=1, **kwargs) @@ -217,12 +220,12 @@ bar("key" => 42, :sym => 43) #=> Ruby 2.6: [{"key"=>42}, {:sym=>43}] #=> Ruby 2.7: [1, {"key"=>42, :sym=>43}] -# Use braces to keep the behavior +# 振る舞いを変えたくない場合は中かっこ{}を使う bar({"key" => 42}, :sym => 43) #=> Ruby 2.6 and 2.7: [{"key"=>42}, {:sym=>43}] {% endhighlight %} -Ruby 2.7 still splits hashes with a warning if passing a Hash or keyword arguments with both Symbol and non-Symbol keys to a method that accepts explicit keywords but no keyword rest argument (`**kwargs`). This behavior will be removed in Ruby 3, and an `ArgumentError` will be raised. +Ruby 2.7では、キーワード引数を明示的に受け付けるがキーワードrest引数(`**kwargs`)を受け取らないメソッドに対して、シンボル形式のキーと非シンボルキーが両方混じったHashやキーワード引数を渡すと、引き続きハッシュを分割して警告を表示します。この振る舞いはRuby 3で廃止されて`ArgumentError`にする予定です。 {% highlight ruby %} def bar(x=1, sym: nil) @@ -230,15 +233,15 @@ def bar(x=1, sym: nil) end bar("key" => 42, :sym => 43) -# Ruby 2.6 and 2.7: => [{"key"=>42}, 43] +# Ruby 2.6と2.7: => [{"key"=>42}, 43] # Ruby 2.7: warning: Splitting the last argument into positional and keyword parameters is deprecated # warning: The called method `bar' is defined here # Ruby 3.0: ArgumentError {% endhighlight %} -### 2. Double splat with an empty hash (`**{}`) passes no arguments +### 2\. double splatを付けた空ハッシュ(`**{}`)で引数を渡さないようになった -In Ruby 2.6 or before, passing `**empty_hash` passes an empty Hash as a positional argument. In Ruby 2.7 or later, it passes no arguments. +Ruby 2.6以前は、`**empty_hash`を渡すと位置引数に空のハッシュが渡されました(`[{}]`)。Ruby 2.7以降では引数を渡さなくなります。 {% highlight ruby %} def foo(*args) @@ -247,13 +250,13 @@ end empty_hash = {} foo(**empty_hash) - #=> Ruby 2.6 or before: [{}] - #=> Ruby 2.7 or later: [] + #=> Ruby 2.6以前: [{}] + #=> Ruby 2.7以降: [] {% endhighlight %} -Note that `foo(**{})` passes nothing in both Ruby 2.6 and 2.7. In Ruby 2.6 and before, `**{}` is removed by the parser, and in Ruby 2.7 and above, it is treated the same as `**empty_hash`, allowing for an easy way to pass no keyword arguments to a method. +なお、`foo(**{})`はRuby 2.6以前とRuby 2.7のどちらの場合も引数を渡さず、`**{}`がパーサーによって削除される点にご注意ください。また、Ruby 2.7以降ではどちらも`**empty_hash`として同じに扱われるので、メソッドにキーワード引数を渡さないようにする指定が楽に行なえます。 -In Ruby 2.7, when calling a method with an insufficient number of required positional arguments, `foo(**empty_hash)` passes an empty hash with a warning emitted, for compatibility with Ruby 2.6. This behavior will be removed in 3.0. +Ruby 2.7では、あるメソッド呼び出しで必須とされる位置引数の個数が不足している場合、Ruby 2.6との互換性を保つために`foo(**empty_hash)`は空のハッシュを渡してwarningを表示します。この振る舞いはRuby 3.0で廃止されます。 {% highlight ruby %} def foo(x) @@ -262,51 +265,51 @@ end empty_hash = {} foo(**empty_hash) - #=> Ruby 2.6 or before: {} + #=> Ruby 2.6以前: {} #=> Ruby 2.7: warning: Passing the keyword argument as the last hash parameter is deprecated # warning: The called method `foo' is defined here #=> Ruby 3.0: ArgumentError: wrong number of arguments {% endhighlight %} -### 3. The no-keyword-arguments syntax (`**nil`) is introduced +### 3\. キーワード引数を受け取らないことを表す構文(`**nil`)が導入される -You can use `**nil` in a method definition to explicitly mark the method accepts no keyword arguments. Calling such methods with keyword arguments will result in an `ArgumentError`. (This is actually a new feature, not an incompatibility) +メソッド定義で`**nil`を用いることで、そのメソッドがキーワード引数を受け取らないことを明示的に示せるようになります。このメソッドを呼び出すときにキーワード引数を渡すと`ArgumentError`が表示されます(これは非互換性ではなく、事実上新機能です)。 {% highlight ruby %} def foo(*args, **nil) end foo(k: 1) - #=> Ruby 2.7 or later: no keywords accepted (ArgumentError) + #=> Ruby 2.7以降: no keywords accepted (ArgumentError) {% endhighlight %} -This is useful to make it explicit that the method does not accept keyword arguments. Otherwise, the keywords are absorbed in the rest argument in the above example. If you extend a method to accept keyword arguments, the method may have incompatibility as follows: +この新構文は、メソッドがキーワード引数を受け取らないことを明示的に指定するのに有用です。これを使わない場合、キーワード引数は上述の例の他の引数に吸い込まれます。メソッドを拡張してキーワード引数を受け取るようにする場合、以下のような非互換性が発生する可能性があります。 {% highlight ruby %} -# If a method accepts rest argument and no `**nil` +# メソッドは残りの引数を受け取るが、`**nil`はない状態 def foo(*args) p args end -# Passing keywords are converted to a Hash object (even in Ruby 3.0) +# キーワード引数はHashオブジェクトに変換される(Ruby 3.0でも同じ) foo(k: 1) #=> [{:k=>1}] -# If the method is extended to accept a keyword +# メソッドがキーワード引数を受け取るよう拡張した場合 def foo(*args, mode: false) p args end -# The existing call may break +# 以下の呼び出しが壊れる可能性がある foo(k: 1) #=> ArgumentError: unknown keyword k {% endhighlight %} -## Why we're deprecating the automatic conversion +## 自動変換を非推奨に変える理由 -The automatic conversion initially appeared to be a good idea, and worked well in many cases. However, it had too many corner cases, and we have received many bug reports about the behavior. +当初、自動変換はうまいアイデアに思われていて、多くの場合問題なく機能していました。しかし、エッジケースがあまりにも多く、これまでこの振る舞いに関するバグレポートを山のように受け取りました。 -Automatic conversion does not work well when a method accepts optional positional arguments and keyword arguments. Some people expect the last Hash object to be treated as a positional argument, and others expect it to be converted to keyword arguments. +自動変換は、オプションの位置引数とキーワード引数をどちらも受け取るメソッドではうまく動きません。末尾のHashオブジェクトを位置引数として扱うことを期待する人々もいれば、末尾のHashオブジェクトをキーワード引数として扱うことを期待する人々もいました。 -Here is one of the most confusing cases: +最も混乱を呼ぶケースのひとつを以下に示します。 {% highlight ruby %} def foo(x, **kwargs) @@ -317,17 +320,17 @@ def bar(x=1, **kwargs) p [x, kwargs] end -foo({}) => [{}, {}] -bar({}) => [1, {}] +foo({}) #=> [{}, {}] +bar({}) #=> [1, {}] -bar({}, **{}) => expected: [{}, {}], actual: [1, {}] +bar({}, **{}) #=> 期待は: [{}, {}]だが実際はl: [1, {}] {% endhighlight %} -In Ruby 2, `foo({})` passes an empty hash as a normal argument (i.e., `{}` is assigned to `x`), while `bar({})` passes a keyword argument (i.e, `{}` is assigned to `kwargs`). So `any_method({})` is very ambiguous. +Ruby 2の場合、`foo({})`は空のハッシュを通常の引数として1つ渡しますが(`x`に`{}`が代入されるなど)、`bar({})`はキーワード引数を1つ渡します(`kwargs`に`{}`が代入されるなど)。つまり、`any_method({})`は極めてあいまいになります。 -You may think of `bar({}, **{})` to pass the empty hash to `x` explicitly. Surprisingly, it does not work as you expected; it still prints `[1, {}]` in Ruby 2.6. This is because `**{}` is ignored by the parser in Ruby 2.6, and the first argument `{}` is automatically converted to keywords (`**kwargs`). In this case, you need to call `bar({}, {})`, which is very weird. +「`bar({}, **{})`は`x`に明示的に空のハッシュを渡すのでは?」と考える人もいるかもしれませんが、驚いたことに、この期待は裏切られます。Ruby 2.6では`[1, {}]`が出力されるのです。理由は、`**{}`がRuby 2.6のパーサーで無視されるのと、1番目の引数`{}`が自動的にキーワード引数(`**kwargs`)に変換されるためです。この場合`bar({}, {})`という形で呼び出す必要がありますが、これではあまりに見苦しくなります。 -The same issues also apply to methods that accept rest and keyword arguments. This makes explicit delegation of keyword arguments not work. +同じ問題は、残りの引数とキーワード引数を受け取るメソッドにも当てはまります。そのせいで、以下のようなキーワード引数の明示的な委譲は動作しません。 {% highlight ruby %} def target(*args) @@ -338,18 +341,18 @@ def foo(*args, **kwargs, &block) target(*args, **kwargs, &block) end -foo() #=> Ruby 2.6 or before: [{}] - #=> Ruby 2.7 or later: [] +foo() #=> Ruby 2.6以前: [{}] + #=> Ruby 2.7以降: [] {% endhighlight %} -`foo()` passes no arguments, but `target` receives an empty hash argument in Ruby 2.6. This is because the method `foo` delegates keywords (`**kwargs`) explicitly. When `foo()` is called, `args` is an empty Array, `kwargs` is an empty Hash, and `block` is `nil`. And then `target(*args, **kwargs, &block)` passes an empty Hash as an argument because `**kwargs` is automatically converted to a positional Hash argument. +`foo()`には引数がありませんが、Ruby 2.6では空のハッシュ引数が`target`に渡されます。理由は、メソッド`foo`が明示的にキーワード(`**kwargs`)を委譲しているためです。`foo()`が呼び出されると、`args`は空のArrayになり、`kwargs`は空のHashになります。そして`target(*args, **kwargs, &block)`は空のHashを引数として1つ渡します。理由は、`**kwargs`が自動的にHash位置引数に変換されるためです。 -The automatic conversion not only confuses people but also makes the method less extensible. See [[Feature #14183]](https://bugs.ruby-lang.org/issues/14183) for more details about the reasons for the change in behavior, and why certain implementation choices were made. +自動変換は開発者を混乱させるのみならず、メソッドの拡張性も弱めてしまいます。振る舞いが変更された理由や、特定の実装が選択された理由について詳しくは[Feature #14183](https://bugs.ruby-lang.org/issues/14183)をご覧ください。 -## Acknowledgment +## 謝辞 -This article was kindly reviewed (or even co-authored) by Jeremy Evans and Benoit Daloze. +本記事はJeremy EvansとBenoit Dalozeによる丁寧なレビュー(共著と言ってもよいくらいです)をいただきました。 -## History +## 更新履歴 -* Updated 2019-12-25: In 2.7.0-rc2, the warning message was slightly changed, and an API to suppress the warnings was added. +* 更新 2019-12-25: 2.7.0-rc2でwarningメッセージが若干変更され、warning抑制APIが追加された。 From 36c88c2bb991242f7ee04d51666df23d6b2c3d6d Mon Sep 17 00:00:00 2001 From: hachi8833 Date: Thu, 30 Jan 2020 16:49:40 +0900 Subject: [PATCH 0081/1090] Fix untranslated lines --- ...ation-of-positional-and-keyword-arguments-in-ruby-3-0.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ja/news/_posts/2019-12-12-separation-of-positional-and-keyword-arguments-in-ruby-3-0.md b/ja/news/_posts/2019-12-12-separation-of-positional-and-keyword-arguments-in-ruby-3-0.md index 5e80e231d5..b9aec21a12 100644 --- a/ja/news/_posts/2019-12-12-separation-of-positional-and-keyword-arguments-in-ruby-3-0.md +++ b/ja/news/_posts/2019-12-12-separation-of-positional-and-keyword-arguments-in-ruby-3-0.md @@ -1,6 +1,6 @@ --- layout: news_post -title: "Separation of positional and keyword arguments in Ruby 3.0" +title: "Ruby 3.0における位置引数とキーワード引数の分離について" author: "mame" translator: "hachi8833" date: 2019-12-12 12:00:00 +0000 @@ -13,8 +13,8 @@ lang: ja Ruby 3.0では、位置引数とキーワード引数が分離されます。Ruby 3.0で変更される振る舞いはRuby 2.7でwarningを表示します。以下のいずれかのwarningが表示される場合は、コードのアップデートが必要です。 -* `Using the last argument as keyword parameters is deprecated`, or -* `Passing the keyword argument as the last hash parameter is deprecated`, or +* `Using the last argument as keyword parameters is deprecated` +* `Passing the keyword argument as the last hash parameter is deprecated` * `Splitting the last argument into positional and keyword parameters is deprecated` この非互換性は、double splat演算子(`**`)を追加することでほぼ回避できます。これにより、`Hash`オブジェクトではなくキーワード引数を渡すことが明示的に指定されます。同様に、キーワード引数ではなく`Hash`オブジェクトを明示的に渡したい場合は中かっこ(`{}`)を追加できます。詳しくは後述の「典型的なケース」をご覧ください。 From 416344e14125e0d3394aa7c45bdc70fc9bb9b734 Mon Sep 17 00:00:00 2001 From: jinroq <2787780+jinroq@users.noreply.github.com> Date: Sat, 27 Nov 2021 00:48:28 +0900 Subject: [PATCH 0082/1090] Revised the points pointed out in the review. --- ...ional-and-keyword-arguments-in-ruby-3-0.md | 34 ++++++++++--------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/ja/news/_posts/2019-12-12-separation-of-positional-and-keyword-arguments-in-ruby-3-0.md b/ja/news/_posts/2019-12-12-separation-of-positional-and-keyword-arguments-in-ruby-3-0.md index b9aec21a12..38c2aea1c9 100644 --- a/ja/news/_posts/2019-12-12-separation-of-positional-and-keyword-arguments-in-ruby-3-0.md +++ b/ja/news/_posts/2019-12-12-separation-of-positional-and-keyword-arguments-in-ruby-3-0.md @@ -11,7 +11,9 @@ lang: ja ## 概要 -Ruby 3.0では、位置引数とキーワード引数が分離されます。Ruby 3.0で変更される振る舞いはRuby 2.7でwarningを表示します。以下のいずれかのwarningが表示される場合は、コードのアップデートが必要です。 +この文書では便宜上、必須引数、オプション引数、rest引数、後置引数(つまり、キーワード引数とブロック引数以外の引数)をまとめて「位置引数」と呼びます。 + +Ruby 3.0では、位置引数とキーワード引数が分離されます。Ruby 3.0で変更される振る舞いはRuby 2.7で警告を表示します。以下のいずれかの警告が表示される場合は、コードのアップデートが必要です。 * `Using the last argument as keyword parameters is deprecated` * `Passing the keyword argument as the last hash parameter is deprecated` @@ -100,13 +102,13 @@ foo(k: 1) #=> {:k=>1} ## Q: 自分のコードはRuby 2.7で動かなくなりますか? -手短かに言うと「壊れない可能性はあります」。 +A: たぶん動きます。 -Ruby 2.7におけるこの変更は、3.0への移行パスとして設計されています。あくまで原則としてですが、Ruby 2.7ではRuby 3.0で変更される振る舞いについてwarningを出すにとどめており、warningの中には私たちが微細とみなしている変更点も若干含まれます。詳しくは後述の「その他の微細な変更点」をご覧ください。 +Ruby 2.7では、原則として、Ruby 3.0で変更される振る舞いについて警告を出すにとどめています。しかし、私たちが軽微とみなした非互換も少しだけ入っています。詳しくは後述の「その他の軽微な変更点」をご覧ください。 -Ruby 2.7では、warningが表示される点と微細な変更点以外を除いてRuby 2.6との互換性を保とうとしています。つまり、あなたのコードはRuby 2.7でもおそらく動作しますが、warningが表示される可能性はあります。あなたのコードをRuby 2.7で実行すれば、Ruby 3.0の準備ができているかどうかをチェックできます。 +Ruby 2.7では、警告が表示される点と軽微な変更点以外を除いてRuby 2.6との互換性を保とうとしています。つまり、あなたのコードはRuby 2.7でもおそらく動作しますが、警告が表示される可能性はあります。あなたのコードをRuby 2.7で実行すれば、Ruby 3.0の準備ができているかどうかをチェックできます。 -非推奨のwarningを無効にしたい場合は、コマンドライン引数`-W:no-deprecated`を使うか、コードに`Warning[:deprecated] = false`を追加します。 +非推奨の警告を無効にしたい場合は、コマンドライン引数`-W:no-deprecated`を使うか、コードに`Warning[:deprecated] = false`を追加します。 ## 引数の委譲の扱いについて @@ -162,7 +164,7 @@ ruby2_keywords def foo(*args, &block) end {% endhighlight %} -残念ながら、Ruby 2.6以前では新しい委譲スタイルを正しく扱えないため、旧来の委譲スタイル(`**kwargs`を使わないなど)を使う必要があります。これは、キーワード引数を分離した理由のひとつでもあります(詳しくは本記事末尾をご覧ください)。`ruby2_keywords`を用いれば、Ruby 2.7や3.0でも旧来の委譲スタイルを引き続き利用できます。2.6以前のRubyでは`ruby2_keywords`が定義されていないので、[ruby2_keywords](https://rubygems.org/gems/ruby2_keywords) gemを使うか、以下を手動で定義します。 +残念ながら、Ruby 2.6以前では新しい委譲スタイルを正しく扱えないため、旧来の委譲スタイル(つまり、**kwargsを受け渡ししないスタイル)を使う必要があります。これは、キーワード引数を分離した理由のひとつでもあります(詳しくは本記事末尾をご覧ください)。`ruby2_keywords`を用いれば、Ruby 2.7や3.0でも旧来の委譲スタイルを引き続き利用できます。2.6以前のRubyでは`ruby2_keywords`が定義されていないので、[ruby2_keywords](https://rubygems.org/gems/ruby2_keywords) gemを使うか、以下を手動で定義します。 {% highlight ruby %} def ruby2_keywords(*) @@ -186,15 +188,15 @@ foo({}) #=> Ruby 2.7: [] ({}を含んでいない) foo({}, **{}) #=> Ruby 2.7: [{}] ({}を渡せば、キーワード引数が「ない」ことを明示できる) {% endhighlight %} -上のコードでは、空のHash引数が自動的に変換されて`**kwargs`に吸い込まれ、この空のキーワードハッシュは委譲の呼び出しで削除されます。このため、`targe`には引数がまったく渡されなくなります。私たちが把握している範囲では、これが唯一のエッジケースです。 +上のコードでは、空のHash引数が自動的に変換されて`**kwargs`に吸い込まれ、この空のキーワードハッシュは委譲の呼び出しで削除されます。このため、`target`には引数がまったく渡されなくなります。私たちが把握している範囲では、これが唯一のエッジケースです。 上のコードの最下部に書いたように、`**{}`を渡すことでこの問題を回避できます。 -移植性がどうしても不安な場合は`ruby2_keywords`をお使いください(Ruby 2.6以前ではキーワード引数周りで膨大なエッジケースが存在していることを知っておいてください)。`ruby2_keywords`は、今後Ruby 2.6が役目を終えたときに削除される可能性があります。現時点で私たちがおすすめできるのは、キーワード引数を明示的に委譲することです(上述のRuby 3向けのコードを参照)。 +移植性がどうしても不安な場合は`ruby2_keywords`をお使いください(Ruby 2.6以前ではキーワード引数周りで膨大なエッジケースが存在していることを知っておいてください)。`ruby2_keywords`は、今後Ruby 2.6がサポート切れになったあとで削除される可能性があります。そのときになったら、キーワード引数を明示的に委譲することをおすすめします(上述のRuby 3向けのコードを参照)。 -## その他の微細な変更点 +## その他の軽微な変更点 -Ruby 2.7のキーワード引数では、この他に以下の3つのマイナーチェンジが行われています。 +Ruby 2.7のキーワード引数では、この他に以下の3つの軽微な変更が行われています。 ### 1\. キーワード引数で非シンボルキーを利用できるようになった @@ -256,7 +258,7 @@ foo(**empty_hash) なお、`foo(**{})`はRuby 2.6以前とRuby 2.7のどちらの場合も引数を渡さず、`**{}`がパーサーによって削除される点にご注意ください。また、Ruby 2.7以降ではどちらも`**empty_hash`として同じに扱われるので、メソッドにキーワード引数を渡さないようにする指定が楽に行なえます。 -Ruby 2.7では、あるメソッド呼び出しで必須とされる位置引数の個数が不足している場合、Ruby 2.6との互換性を保つために`foo(**empty_hash)`は空のハッシュを渡してwarningを表示します。この振る舞いはRuby 3.0で廃止されます。 +Ruby 2.7では、あるメソッド呼び出しで必須とされる位置引数の個数が不足している場合、Ruby 2.6との互換性を保つために`foo(**empty_hash)`は空のハッシュを渡して警告を表示します。この振る舞いはRuby 3.0で廃止されます。 {% highlight ruby %} def foo(x) @@ -273,7 +275,7 @@ foo(**empty_hash) ### 3\. キーワード引数を受け取らないことを表す構文(`**nil`)が導入される -メソッド定義で`**nil`を用いることで、そのメソッドがキーワード引数を受け取らないことを明示的に示せるようになります。このメソッドを呼び出すときにキーワード引数を渡すと`ArgumentError`が表示されます(これは非互換性ではなく、事実上新機能です)。 +メソッド定義で`**nil`を用いることで、そのメソッドがキーワード引数を受け取らないことを明示的に示せるようになります。このメソッドを呼び出すときにキーワード引数を渡すと`ArgumentError`が表示されます(これは非互換性ではなく、新機能です)。 {% highlight ruby %} def foo(*args, **nil) @@ -283,7 +285,7 @@ foo(k: 1) #=> Ruby 2.7以降: no keywords accepted (ArgumentError) {% endhighlight %} -この新構文は、メソッドがキーワード引数を受け取らないことを明示的に指定するのに有用です。これを使わない場合、キーワード引数は上述の例の他の引数に吸い込まれます。メソッドを拡張してキーワード引数を受け取るようにする場合、以下のような非互換性が発生する可能性があります。 +この新構文は、メソッドがキーワード引数を受け取らないことを明示的に指定するのに有用です。これを使わない場合、キーワード引数は上述の例のrest引数に吸い込まれます。メソッドを拡張してキーワード引数を受け取るようにする場合、以下のような非互換性が発生する可能性があります。 {% highlight ruby %} # メソッドは残りの引数を受け取るが、`**nil`はない状態 @@ -307,7 +309,7 @@ foo(k: 1) #=> ArgumentError: unknown keyword k 当初、自動変換はうまいアイデアに思われていて、多くの場合問題なく機能していました。しかし、エッジケースがあまりにも多く、これまでこの振る舞いに関するバグレポートを山のように受け取りました。 -自動変換は、オプションの位置引数とキーワード引数をどちらも受け取るメソッドではうまく動きません。末尾のHashオブジェクトを位置引数として扱うことを期待する人々もいれば、末尾のHashオブジェクトをキーワード引数として扱うことを期待する人々もいました。 +自動変換は、オプション引数とキーワード引数をどちらも受け取るメソッドではうまく動きません。末尾のHashオブジェクトを位置引数として扱うことを期待する人々もいれば、末尾のHashオブジェクトをキーワード引数として扱うことを期待する人々もいました。 最も混乱を呼ぶケースのひとつを以下に示します。 @@ -345,7 +347,7 @@ foo() #=> Ruby 2.6以前: [{}] #=> Ruby 2.7以降: [] {% endhighlight %} -`foo()`には引数がありませんが、Ruby 2.6では空のハッシュ引数が`target`に渡されます。理由は、メソッド`foo`が明示的にキーワード(`**kwargs`)を委譲しているためです。`foo()`が呼び出されると、`args`は空のArrayになり、`kwargs`は空のHashになります。そして`target(*args, **kwargs, &block)`は空のHashを引数として1つ渡します。理由は、`**kwargs`が自動的にHash位置引数に変換されるためです。 +`foo()`には引数がありませんが、Ruby 2.6では空のハッシュ引数が`target`に渡されます。理由は、メソッド`foo`が明示的にキーワード(`**kwargs`)を委譲しているためです。`foo()`が呼び出されると、`args`は空のArrayになり、`kwargs`は空のHashになり、blockはnilになります。。そして`target(*args, **kwargs, &block)`は空のHashを引数として1つ渡します。理由は、`**kwargs`が自動的にHash位置引数に変換されるためです。 自動変換は開発者を混乱させるのみならず、メソッドの拡張性も弱めてしまいます。振る舞いが変更された理由や、特定の実装が選択された理由について詳しくは[Feature #14183](https://bugs.ruby-lang.org/issues/14183)をご覧ください。 @@ -355,4 +357,4 @@ foo() #=> Ruby 2.6以前: [{}] ## 更新履歴 -* 更新 2019-12-25: 2.7.0-rc2でwarningメッセージが若干変更され、warning抑制APIが追加された。 +* 更新 2019-12-25: 2.7.0-rc2で警告メッセージが若干変更され、警告抑制APIが追加された。 From 177e9c20ebd9f893fc9c1350840a507230d5d102 Mon Sep 17 00:00:00 2001 From: Yusuke Endoh Date: Mon, 29 Nov 2021 09:43:56 +0900 Subject: [PATCH 0083/1090] Markup --- ...eparation-of-positional-and-keyword-arguments-in-ruby-3-0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ja/news/_posts/2019-12-12-separation-of-positional-and-keyword-arguments-in-ruby-3-0.md b/ja/news/_posts/2019-12-12-separation-of-positional-and-keyword-arguments-in-ruby-3-0.md index 38c2aea1c9..7b981ae761 100644 --- a/ja/news/_posts/2019-12-12-separation-of-positional-and-keyword-arguments-in-ruby-3-0.md +++ b/ja/news/_posts/2019-12-12-separation-of-positional-and-keyword-arguments-in-ruby-3-0.md @@ -347,7 +347,7 @@ foo() #=> Ruby 2.6以前: [{}] #=> Ruby 2.7以降: [] {% endhighlight %} -`foo()`には引数がありませんが、Ruby 2.6では空のハッシュ引数が`target`に渡されます。理由は、メソッド`foo`が明示的にキーワード(`**kwargs`)を委譲しているためです。`foo()`が呼び出されると、`args`は空のArrayになり、`kwargs`は空のHashになり、blockはnilになります。。そして`target(*args, **kwargs, &block)`は空のHashを引数として1つ渡します。理由は、`**kwargs`が自動的にHash位置引数に変換されるためです。 +`foo()`には引数がありませんが、Ruby 2.6では空のハッシュ引数が`target`に渡されます。理由は、メソッド`foo`が明示的にキーワード(`**kwargs`)を委譲しているためです。`foo()`が呼び出されると、`args`は空のArrayになり、`kwargs`は空のHashになり、`block`は`nil`になります。そして`target(*args, **kwargs, &block)`は空のHashを引数として1つ渡します。理由は、`**kwargs`が自動的にHash位置引数に変換されるためです。 自動変換は開発者を混乱させるのみならず、メソッドの拡張性も弱めてしまいます。振る舞いが変更された理由や、特定の実装が選択された理由について詳しくは[Feature #14183](https://bugs.ruby-lang.org/issues/14183)をご覧ください。 From 2ddada69b79bbcce70fbf3e8888b7fe805dbf27a Mon Sep 17 00:00:00 2001 From: hachi8833 Date: Wed, 22 Jan 2020 12:35:17 +0900 Subject: [PATCH 0084/1090] Add en doc --- ...ional-and-keyword-arguments-in-ruby-3-0.md | 355 ++++++++++++++++++ 1 file changed, 355 insertions(+) create mode 100644 ja/news/_posts/2019-12-12-separation-of-positional-and-keyword-arguments-in-ruby-3-0.md diff --git a/ja/news/_posts/2019-12-12-separation-of-positional-and-keyword-arguments-in-ruby-3-0.md b/ja/news/_posts/2019-12-12-separation-of-positional-and-keyword-arguments-in-ruby-3-0.md new file mode 100644 index 0000000000..44cd874cc1 --- /dev/null +++ b/ja/news/_posts/2019-12-12-separation-of-positional-and-keyword-arguments-in-ruby-3-0.md @@ -0,0 +1,355 @@ +--- +layout: news_post +title: "Separation of positional and keyword arguments in Ruby 3.0" +author: "mame" +translator: +date: 2019-12-12 12:00:00 +0000 +lang: en +--- + +This article explains the planned incompatibility of keyword arguments in Ruby 3.0 + +## tl;dr + +In Ruby 3.0, positional arguments and keyword arguments will be separated. Ruby 2.7 will warn for behaviors that will change in Ruby 3.0. If you see the following warnings, you need to update your code: + +* `Using the last argument as keyword parameters is deprecated`, or +* `Passing the keyword argument as the last hash parameter is deprecated`, or +* `Splitting the last argument into positional and keyword parameters is deprecated` + +In most cases, you can avoid the incompatibility by adding the _double splat_ operator. It explicitly specifies passing keyword arguments instead of a `Hash` object. Likewise, you may add braces `{}` to explicitly pass a `Hash` object, instead of keyword arguments. Read the section "Typical cases" below for more details. + +In Ruby 3, a method delegating all arguments must explicitly delegate keyword arguments in addition to positional arguments. If you want to keep the delegation behavior found in Ruby 2.7 and earlier, use `ruby2_keywords`. See the "Handling argument delegation" section below for more details. + +## Typical cases + +Here is the most typical case. You can use double splat operator (`**`) to pass keywords instead of a Hash. + +{% highlight ruby %} +# This method accepts only a keyword argument +def foo(k: 1) + p k +end + +h = { k: 42 } + +# This method call passes a positional Hash argument +# In Ruby 2.7: The Hash is automatically converted to a keyword argument +# In Ruby 3.0: This call raises an ArgumentError +foo(h) + # => demo.rb:11: warning: Using the last argument as keyword parameters is deprecated; maybe ** should be added to the call + # demo.rb:2: warning: The called method `foo' is defined here + # 42 + +# If you want to keep the behavior in Ruby 3.0, use double splat +foo(**h) #=> 42 +{% endhighlight %} + +Here is another case. You can use braces (`{}`) to pass a Hash instead of keywords explicitly. + +{% highlight ruby %} +# This method accepts one positional argument and a keyword rest argument +def bar(h, **kwargs) + p h +end + +# This call passes only a keyword argument and no positional arguments +# In Ruby 2.7: The keyword is converted to a positional Hash argument +# In Ruby 3.0: This call raises an ArgumentError +bar(k: 42) + # => demo2.rb:9: warning: Passing the keyword argument as the last hash parameter is deprecated + # demo2.rb:2: warning: The called method `bar' is defined here + # {:k=>42} + +# If you want to keep the behavior in Ruby 3.0, write braces to make it an +# explicit Hash +bar({ k: 42 }) # => {:k=>42} +{% endhighlight %} + +## What is deprecated? + +In Ruby 2, keyword arguments can be treated as the last positional Hash argument and a last positional Hash argument can be treated as keyword arguments. + +Because the automatic conversion is sometimes too complex and troublesome as described in the final section. So it's now deprecated in Ruby 2.7 and will be removed in Ruby 3. In other words, keyword arguments will be completely separated from positional one in Ruby 3. So when you want to pass keyword arguments, you should always use `foo(k: expr)` or `foo(**expr)`. If you want to accept keyword arguments, in principle you should always use `def foo(k: default)` or `def foo(k:)` or `def foo(**kwargs)`. + +Note that Ruby 3.0 doesn't behave differently when calling a method which doesn't accept keyword arguments with keyword arguments. For instance, the following case is not going to be deprecated and will keep working in Ruby 3.0. The keyword arguments are still treated as a positional Hash argument. + +{% highlight ruby %} +def foo(kwargs = {}) + kwargs +end + +foo(k: 1) #=> {:k=>1} +{% endhighlight %} + +This is because this style is used very frequently, and there is no ambiguity in how the argument should be treated. Prohibiting this conversion would result in additional incompatibility for little benefit. + +However, this style is not recommended in new code, unless you are often passing a Hash as a positional argument, and are also using keyword arguments. Otherwise, use double splat: + +{% highlight ruby %} +def foo(**kwargs) + kwargs +end + +foo(k: 1) #=> {:k=>1} +{% endhighlight %} + +## Will my code break on Ruby 2.7? + +A short answer is "maybe not". + +The changes in Ruby 2.7 are designed as a migration path towards 3.0. While in principle, Ruby 2.7 only warns against behaviors that will change in Ruby 3, it includes some incompatible changes we consider to be minor. See the "Other minor changes" section for details. + +Except for the warnings and minor changes, Ruby 2.7 attempts to keep the compatibility with Ruby 2.6. So, your code will probably work on Ruby 2.7, though it may emit warnings. And by running it on Ruby 2.7, you can check if your code is ready for Ruby 3.0. + +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. + +## Handling argument delegation + +### Ruby 2.6 or prior + +In Ruby 2, you can write a delegation method by accepting a `*rest` argument and a `&block` argument, and passing the two to the target method. In this behavior, the keyword arguments are also implicitly handled by the automatic conversion between positional and keyword arguments. + +{% highlight ruby %} +def foo(*args, &block) + target(*args, &block) +end +{% endhighlight %} + +### Ruby 3 + +You need to explicitly delegate keyword arguments. + +{% highlight ruby %} +def foo(*args, **kwargs, &block) + target(*args, **kwargs, &block) +end +{% endhighlight %} + +Alternatively, if you do not need compatibility with Ruby 2.6 or prior and you don't alter any arguments, you can use the new delegation syntax (`...`) that is introduced in Ruby 2.7. + +{% highlight ruby %} +def foo(...) + target(...) +end +{% endhighlight %} + +### Ruby 2.7 + +In short: use `Module#ruby2_keywords` and delegate `*args, &block`. + +{% highlight ruby %} +ruby2_keywords def foo(*args, &block) + target(*args, &block) +end +{% endhighlight %} + +`ruby2_keywords` accepts keyword arguments as the last Hash argument, and passes it as keyword arguments when calling the other method. + +In fact, Ruby 2.7 allows the new style of delegation in many cases. However, there is a known corner case. See the next section. + +### A compatible delegation that works on Ruby 2.6, 2.7 and Ruby 3 + +In short: use `Module#ruby2_keywords` again. + +{% highlight ruby %} +ruby2_keywords def foo(*args, &block) + target(*args, &block) +end +{% endhighlight %} + +Unfortunately, we need to use the old-style delegation (i.e., no `**kwargs`) because Ruby 2.6 or prior does not handle the new delegation style correctly. This is one of the reasons of the keyword argument separation; the details are described in the final section. And `ruby2_keywords` allows you to run the old style even in Ruby 2.7 and 3.0. As there is no `ruby2_keywords` defined in 2.6 or prior, please use the [ruby2_keywords gem](https://rubygems.org/gems/ruby2_keywords) or define it yourself: + +{% highlight ruby %} +def ruby2_keywords(*) +end if RUBY_VERSION < "2.7" +{% endhighlight %} + +--- + +If your code doesn't have to run on Ruby 2.6 or older, you may try the new style in Ruby 2.7. In almost all cases, it works. Note that, however, there are unfortunate corner cases as follows: + +{% highlight ruby %} +def target(*args) + p args +end + +def foo(*args, **kwargs, &block) + target(*args, **kwargs, &block) +end + +foo({}) #=> Ruby 2.7: [] ({} is dropped) +foo({}, **{}) #=> Ruby 2.7: [{}] (You can pass {} by explicitly passing "no" keywords) +{% endhighlight %} + +An empty Hash argument is automatically converted and absorbed into `**kwargs`, and the delegation call removes the empty keyword hash, so no argument is passed to `target`. As far as we know, this is the only corner case. + +As noted in the last line, you can work around this issue by using `**{}`. + +If you really worry about the portability, use `ruby2_keywords`. (Acknowledge that Ruby 2.6 or before themselves have tons of corner cases in keyword arguments. :-) +`ruby2_keywords` might be removed in the future after Ruby 2.6 reaches end-of-life. At that point, we recommend to explicitly delegate keyword arguments (see Ruby 3 code above). + +## Other minor changes + +There are three minor changes about keyword arguments in Ruby 2.7. + +### 1. Non-Symbol keys are allowed in keyword arguments + +In Ruby 2.6 or before, only Symbol keys were allowed in keyword arguments. In Ruby 2.7, keyword arguments can use non-Symbol keys. + +{% highlight ruby %} +def foo(**kwargs) + kwargs +end +foo("key" => 42) + #=> Ruby 2.6 or before: ArgumentError: wrong number of arguments + #=> Ruby 2.7 or later: {"key"=>42} +{% endhighlight %} + +If a method accepts both optional and keyword arguments, the Hash object that has both Symbol keys and non-Symbol keys was split in two in Ruby 2.6. In Ruby 2.7, both are accepted as keywords because non-Symbol keys are allowed. + +{% highlight ruby %} +def bar(x=1, **kwargs) + p [x, kwargs] +end + +bar("key" => 42, :sym => 43) + #=> Ruby 2.6: [{"key"=>42}, {:sym=>43}] + #=> Ruby 2.7: [1, {"key"=>42, :sym=>43}] + +# Use braces to keep the behavior +bar({"key" => 42}, :sym => 43) + #=> Ruby 2.6 and 2.7: [{"key"=>42}, {:sym=>43}] +{% endhighlight %} + +Ruby 2.7 still splits hashes with a warning if passing a Hash or keyword arguments with both Symbol and non-Symbol keys to a method that accepts explicit keywords but no keyword rest argument (`**kwargs`). This behavior will be removed in Ruby 3, and an `ArgumentError` will be raised. + +{% highlight ruby %} +def bar(x=1, sym: nil) + p [x, sym] +end + +bar("key" => 42, :sym => 43) +# Ruby 2.6 and 2.7: => [{"key"=>42}, 43] +# Ruby 2.7: warning: Splitting the last argument into positional and keyword parameters is deprecated +# warning: The called method `bar' is defined here +# Ruby 3.0: ArgumentError +{% endhighlight %} + +### 2. Double splat with an empty hash (`**{}`) passes no arguments + +In Ruby 2.6 or before, passing `**empty_hash` passes an empty Hash as a positional argument. In Ruby 2.7 or later, it passes no arguments. + +{% highlight ruby %} +def foo(*args) + args +end + +empty_hash = {} +foo(**empty_hash) + #=> Ruby 2.6 or before: [{}] + #=> Ruby 2.7 or later: [] +{% endhighlight %} + +Note that `foo(**{})` passes nothing in both Ruby 2.6 and 2.7. In Ruby 2.6 and before, `**{}` is removed by the parser, and in Ruby 2.7 and above, it is treated the same as `**empty_hash`, allowing for an easy way to pass no keyword arguments to a method. + +In Ruby 2.7, when calling a method with an insufficient number of required positional arguments, `foo(**empty_hash)` passes an empty hash with a warning emitted, for compatibility with Ruby 2.6. This behavior will be removed in 3.0. + +{% highlight ruby %} +def foo(x) + x +end + +empty_hash = {} +foo(**empty_hash) + #=> Ruby 2.6 or before: {} + #=> Ruby 2.7: warning: Passing the keyword argument as the last hash parameter is deprecated + # warning: The called method `foo' is defined here + #=> Ruby 3.0: ArgumentError: wrong number of arguments +{% endhighlight %} + +### 3. The no-keyword-arguments syntax (`**nil`) is introduced + +You can use `**nil` in a method definition to explicitly mark the method accepts no keyword arguments. Calling such methods with keyword arguments will result in an `ArgumentError`. (This is actually a new feature, not an incompatibility) + +{% highlight ruby %} +def foo(*args, **nil) +end + +foo(k: 1) + #=> Ruby 2.7 or later: no keywords accepted (ArgumentError) +{% endhighlight %} + +This is useful to make it explicit that the method does not accept keyword arguments. Otherwise, the keywords are absorbed in the rest argument in the above example. If you extend a method to accept keyword arguments, the method may have incompatibility as follows: + +{% highlight ruby %} +# If a method accepts rest argument and no `**nil` +def foo(*args) + p args +end + +# Passing keywords are converted to a Hash object (even in Ruby 3.0) +foo(k: 1) #=> [{:k=>1}] + +# If the method is extended to accept a keyword +def foo(*args, mode: false) + p args +end + +# The existing call may break +foo(k: 1) #=> ArgumentError: unknown keyword k +{% endhighlight %} + +## Why we're deprecating the automatic conversion + +The automatic conversion initially appeared to be a good idea, and worked well in many cases. However, it had too many corner cases, and we have received many bug reports about the behavior. + +Automatic conversion does not work well when a method accepts optional positional arguments and keyword arguments. Some people expect the last Hash object to be treated as a positional argument, and others expect it to be converted to keyword arguments. + +Here is one of the most confusing cases: + +{% highlight ruby %} +def foo(x, **kwargs) + p [x, kwargs] +end + +def bar(x=1, **kwargs) + p [x, kwargs] +end + +foo({}) => [{}, {}] +bar({}) => [1, {}] + +bar({}, **{}) => expected: [{}, {}], actual: [1, {}] +{% endhighlight %} + +In Ruby 2, `foo({})` passes an empty hash as a normal argument (i.e., `{}` is assigned to `x`), while `bar({})` passes a keyword argument (i.e, `{}` is assigned to `kwargs`). So `any_method({})` is very ambiguous. + +You may think of `bar({}, **{})` to pass the empty hash to `x` explicitly. Surprisingly, it does not work as you expected; it still prints `[1, {}]` in Ruby 2.6. This is because `**{}` is ignored by the parser in Ruby 2.6, and the first argument `{}` is automatically converted to keywords (`**kwargs`). In this case, you need to call `bar({}, {})`, which is very weird. + +The same issues also apply to methods that accept rest and keyword arguments. This makes explicit delegation of keyword arguments not work. + +{% highlight ruby %} +def target(*args) + p args +end + +def foo(*args, **kwargs, &block) + target(*args, **kwargs, &block) +end + +foo() #=> Ruby 2.6 or before: [{}] + #=> Ruby 2.7 or later: [] +{% endhighlight %} + +`foo()` passes no arguments, but `target` receives an empty hash argument in Ruby 2.6. This is because the method `foo` delegates keywords (`**kwargs`) explicitly. When `foo()` is called, `args` is an empty Array, `kwargs` is an empty Hash, and `block` is `nil`. And then `target(*args, **kwargs, &block)` passes an empty Hash as an argument because `**kwargs` is automatically converted to a positional Hash argument. + +The automatic conversion not only confuses people but also makes the method less extensible. See [[Feature #14183]](https://bugs.ruby-lang.org/issues/14183) for more details about the reasons for the change in behavior, and why certain implementation choices were made. + +## Acknowledgment + +This article was kindly reviewed (or even co-authored) by Jeremy Evans and Benoit Daloze. + +## History + +* Updated 2019-12-25: In 2.7.0-rc2, the warning message was slightly changed, and an API to suppress the warnings was added. From b98d7083356c9cf8ecab750872108243561e38cb Mon Sep 17 00:00:00 2001 From: hachi8833 Date: Wed, 22 Jan 2020 12:35:47 +0900 Subject: [PATCH 0085/1090] Translate "Separation of positional and keyword arguments in Ruby 3.0" --- ...ional-and-keyword-arguments-in-ruby-3-0.md | 195 +++++++++--------- 1 file changed, 99 insertions(+), 96 deletions(-) diff --git a/ja/news/_posts/2019-12-12-separation-of-positional-and-keyword-arguments-in-ruby-3-0.md b/ja/news/_posts/2019-12-12-separation-of-positional-and-keyword-arguments-in-ruby-3-0.md index 44cd874cc1..5e80e231d5 100644 --- a/ja/news/_posts/2019-12-12-separation-of-positional-and-keyword-arguments-in-ruby-3-0.md +++ b/ja/news/_posts/2019-12-12-separation-of-positional-and-keyword-arguments-in-ruby-3-0.md @@ -2,77 +2,81 @@ layout: news_post title: "Separation of positional and keyword arguments in Ruby 3.0" author: "mame" -translator: +translator: "hachi8833" date: 2019-12-12 12:00:00 +0000 -lang: en +lang: ja --- -This article explains the planned incompatibility of keyword arguments in Ruby 3.0 +本記事では、Ruby 3.0で予定されているキーワード引数の非互換性について解説します。 -## tl;dr +## 概要 -In Ruby 3.0, positional arguments and keyword arguments will be separated. Ruby 2.7 will warn for behaviors that will change in Ruby 3.0. If you see the following warnings, you need to update your code: +Ruby 3.0では、位置引数とキーワード引数が分離されます。Ruby 3.0で変更される振る舞いはRuby 2.7でwarningを表示します。以下のいずれかのwarningが表示される場合は、コードのアップデートが必要です。 * `Using the last argument as keyword parameters is deprecated`, or * `Passing the keyword argument as the last hash parameter is deprecated`, or * `Splitting the last argument into positional and keyword parameters is deprecated` -In most cases, you can avoid the incompatibility by adding the _double splat_ operator. It explicitly specifies passing keyword arguments instead of a `Hash` object. Likewise, you may add braces `{}` to explicitly pass a `Hash` object, instead of keyword arguments. Read the section "Typical cases" below for more details. +この非互換性は、double splat演算子(`**`)を追加することでほぼ回避できます。これにより、`Hash`オブジェクトではなくキーワード引数を渡すことが明示的に指定されます。同様に、キーワード引数ではなく`Hash`オブジェクトを明示的に渡したい場合は中かっこ(`{}`)を追加できます。詳しくは後述の「典型的なケース」をご覧ください。 -In Ruby 3, a method delegating all arguments must explicitly delegate keyword arguments in addition to positional arguments. If you want to keep the delegation behavior found in Ruby 2.7 and earlier, use `ruby2_keywords`. See the "Handling argument delegation" section below for more details. +Ruby 3では、すべての引数を委譲するメソッドで、位置引数の他に必ずキーワード引数も明示的に委譲しなければなりません。Ruby 2.7以前の委譲の振る舞いを変えたくない場合は、`ruby2_keywords`をお使いください。詳しくは後述の「引数の委譲の扱いについて」をご覧ください。 -## Typical cases +## よくあるケース -Here is the most typical case. You can use double splat operator (`**`) to pass keywords instead of a Hash. +以下はもっともよくあるケースです。Hashではなくキーワードを渡すのにdouble splat演算子(`**`)を使えます。 {% highlight ruby %} -# This method accepts only a keyword argument +# このメソッドはキーワード引数のみを受け取る def foo(k: 1) p k end h = { k: 42 } -# This method call passes a positional Hash argument -# In Ruby 2.7: The Hash is automatically converted to a keyword argument -# In Ruby 3.0: This call raises an ArgumentError +# このメソッド呼び出しは位置引数としてHashを渡している +# Ruby 2.7: このHashは自動でキーワード引数に変換される +# Ruby 3.0: この呼び出しはArgumentErrorになる foo(h) # => demo.rb:11: warning: Using the last argument as keyword parameters is deprecated; maybe ** should be added to the call # demo.rb:2: warning: The called method `foo' is defined here # 42 -# If you want to keep the behavior in Ruby 3.0, use double splat +# この振る舞いをRuby 3.0で変えたくない場合はdouble splatを用いる foo(**h) #=> 42 {% endhighlight %} -Here is another case. You can use braces (`{}`) to pass a Hash instead of keywords explicitly. +別の例: キーワード引数ではなくHashを明示的に渡す場合は中かっこ(`{}`)を使います。 {% highlight ruby %} -# This method accepts one positional argument and a keyword rest argument +# このメソッドは位置引数を1個、残りはキーワード引数を受け取る def bar(h, **kwargs) p h end -# This call passes only a keyword argument and no positional arguments -# In Ruby 2.7: The keyword is converted to a positional Hash argument -# In Ruby 3.0: This call raises an ArgumentError +# この呼び出しではキーワード引数のみが渡され、位置引数は渡されない +# Ruby 2.7: このキーワード引数は自動でHash引数に変換される +# Ruby 3.0: この呼び出しはArgumentErrorになる bar(k: 42) # => demo2.rb:9: warning: Passing the keyword argument as the last hash parameter is deprecated # demo2.rb:2: warning: The called method `bar' is defined here # {:k=>42} -# If you want to keep the behavior in Ruby 3.0, write braces to make it an -# explicit Hash +# この振る舞いをRuby 3.0で変えたくない場合は +# 中かっこで明示的にHashにする bar({ k: 42 }) # => {:k=>42} {% endhighlight %} -## What is deprecated? +## どの動作が非推奨になるか -In Ruby 2, keyword arguments can be treated as the last positional Hash argument and a last positional Hash argument can be treated as keyword arguments. +Ruby 2では、キーワード引数が末尾のハッシュ位置引数として扱われることがあります。また、末尾のハッシュ引数がキーワード引数として扱われることもあります。 -Because the automatic conversion is sometimes too complex and troublesome as described in the final section. So it's now deprecated in Ruby 2.7 and will be removed in Ruby 3. In other words, keyword arguments will be completely separated from positional one in Ruby 3. So when you want to pass keyword arguments, you should always use `foo(k: expr)` or `foo(**expr)`. If you want to accept keyword arguments, in principle you should always use `def foo(k: default)` or `def foo(k:)` or `def foo(**kwargs)`. +この自動変換は場合によっては複雑になりすぎてしまい、本記事末尾で後述するようにトラブルの原因になることがあります。そのため、この自動変換をRuby 2.7で非推奨とし、Ruby 3.0で廃止する予定です。言い換えると、Ruby 3.0のキーワード引数は位置引数と完全に分離されることになります。つまり、キーワード引数を渡したい場合は、常に`foo(k: expr)`または`foo(**expr)`の形にすべきです。(メソッド定義で)キーワード引数を受け取りたい場合は、原則として常に以下のいずれかの形にすべきです。 -Note that Ruby 3.0 doesn't behave differently when calling a method which doesn't accept keyword arguments with keyword arguments. For instance, the following case is not going to be deprecated and will keep working in Ruby 3.0. The keyword arguments are still treated as a positional Hash argument. +* `def foo(k: default)` +* `def foo(k:)` +* `def foo(**kwargs)` + +なお、キーワード引数を受け取らないメソッドを呼び出すときにキーワード引数を渡した場合の振る舞いは、Ruby 3.0でも変わらない点にご注意ください。たとえば、以下のケースは非推奨にはならず、Ruby 3.0でも引き続き動作します(このキーワード引数は引き続きHash位置引数として扱われます)。 {% highlight ruby %} def foo(kwargs = {}) @@ -82,9 +86,9 @@ end foo(k: 1) #=> {:k=>1} {% endhighlight %} -This is because this style is used very frequently, and there is no ambiguity in how the argument should be treated. Prohibiting this conversion would result in additional incompatibility for little benefit. +変わらない理由は、このスタイルが非常によく用いられていることと、この呼び出し方法では引数の扱いに曖昧な点がないためです。この振る舞いまで禁止してしまうと、得られるメリットが少ないうえに非互換性がさらに増えてしまいます。 -However, this style is not recommended in new code, unless you are often passing a Hash as a positional argument, and are also using keyword arguments. Otherwise, use double splat: +ただし今後新しいコードを書く場合、このスタイルはおすすめできません(Hashを位置引数として渡す頻度が高く、かつキーワード引数も使う場合を除く)。代わりに、次のようにdouble splat(`**`)をお使いください。 {% highlight ruby %} def foo(**kwargs) @@ -94,21 +98,21 @@ end foo(k: 1) #=> {:k=>1} {% endhighlight %} -## Will my code break on Ruby 2.7? +## Q: 自分のコードはRuby 2.7で動かなくなりますか? -A short answer is "maybe not". +手短かに言うと「壊れない可能性はあります」。 -The changes in Ruby 2.7 are designed as a migration path towards 3.0. While in principle, Ruby 2.7 only warns against behaviors that will change in Ruby 3, it includes some incompatible changes we consider to be minor. See the "Other minor changes" section for details. +Ruby 2.7におけるこの変更は、3.0への移行パスとして設計されています。あくまで原則としてですが、Ruby 2.7ではRuby 3.0で変更される振る舞いについてwarningを出すにとどめており、warningの中には私たちが微細とみなしている変更点も若干含まれます。詳しくは後述の「その他の微細な変更点」をご覧ください。 -Except for the warnings and minor changes, Ruby 2.7 attempts to keep the compatibility with Ruby 2.6. So, your code will probably work on Ruby 2.7, though it may emit warnings. And by running it on Ruby 2.7, you can check if your code is ready for Ruby 3.0. +Ruby 2.7では、warningが表示される点と微細な変更点以外を除いてRuby 2.6との互換性を保とうとしています。つまり、あなたのコードはRuby 2.7でもおそらく動作しますが、warningが表示される可能性はあります。あなたのコードをRuby 2.7で実行すれば、Ruby 3.0の準備ができているかどうかをチェックできます。 -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. +非推奨のwarningを無効にしたい場合は、コマンドライン引数`-W:no-deprecated`を使うか、コードに`Warning[:deprecated] = false`を追加します。 -## Handling argument delegation +## 引数の委譲の扱いについて -### Ruby 2.6 or prior +### Ruby 2.6以前の場合 -In Ruby 2, you can write a delegation method by accepting a `*rest` argument and a `&block` argument, and passing the two to the target method. In this behavior, the keyword arguments are also implicitly handled by the automatic conversion between positional and keyword arguments. +Ruby 2では、以下のように1個の`*rest`引数と1個の`&block`引数を受け付けて、この2つの引数を委譲先メソッド(以下の`target`)に渡すことで委譲メソッドを書けます。この振る舞いでは、(1つ以上の)キーワード引数も「位置引数<=>キーワード引数の自動変換」によって暗黙的に扱われます。 {% highlight ruby %} def foo(*args, &block) @@ -116,9 +120,9 @@ def foo(*args, &block) end {% endhighlight %} -### Ruby 3 +### Ruby 3の場合 -You need to explicitly delegate keyword arguments. +以下のようにキーワード引数を明示的に委譲する必要があります。 {% highlight ruby %} def foo(*args, **kwargs, &block) @@ -126,7 +130,7 @@ def foo(*args, **kwargs, &block) end {% endhighlight %} -Alternatively, if you do not need compatibility with Ruby 2.6 or prior and you don't alter any arguments, you can use the new delegation syntax (`...`) that is introduced in Ruby 2.7. +別の方法として、Ruby 2.6以前との互換性を考慮する必要がなく、かつ引数を一切改変しないのであれば、以下のようにRuby 2.7で新しく導入される委譲構文(`...`)を利用できます。 {% highlight ruby %} def foo(...) @@ -134,9 +138,9 @@ def foo(...) end {% endhighlight %} -### Ruby 2.7 +### Ruby 2.7の場合 -In short: use `Module#ruby2_keywords` and delegate `*args, &block`. +手短かに言うと、以下のように`Module#ruby2_keywords`を用い、`*args, &block`を委譲します。 {% highlight ruby %} ruby2_keywords def foo(*args, &block) @@ -144,13 +148,13 @@ ruby2_keywords def foo(*args, &block) end {% endhighlight %} -`ruby2_keywords` accepts keyword arguments as the last Hash argument, and passes it as keyword arguments when calling the other method. +`ruby2_keywords`を指定すると、キーワード引数を末尾のHash引数として受け取れるようになり、他のメソッドを呼び出すときにそれをキーワード引数として渡せます。 -In fact, Ruby 2.7 allows the new style of delegation in many cases. However, there is a known corner case. See the next section. +実際、Ruby 2.7では多くの場面でこの新しい委譲のスタイルを利用できます。ただし1つ既知のエッジケースがあります。次をご覧ください。 -### A compatible delegation that works on Ruby 2.6, 2.7 and Ruby 3 +### Ruby 2.6 / 2.7 / 3で互換性のある委譲スタイル -In short: use `Module#ruby2_keywords` again. +手短かに言うと、ここも「`Module#ruby2_keywords`を使う」となります。 {% highlight ruby %} ruby2_keywords def foo(*args, &block) @@ -158,16 +162,16 @@ ruby2_keywords def foo(*args, &block) end {% endhighlight %} -Unfortunately, we need to use the old-style delegation (i.e., no `**kwargs`) because Ruby 2.6 or prior does not handle the new delegation style correctly. This is one of the reasons of the keyword argument separation; the details are described in the final section. And `ruby2_keywords` allows you to run the old style even in Ruby 2.7 and 3.0. As there is no `ruby2_keywords` defined in 2.6 or prior, please use the [ruby2_keywords gem](https://rubygems.org/gems/ruby2_keywords) or define it yourself: +残念ながら、Ruby 2.6以前では新しい委譲スタイルを正しく扱えないため、旧来の委譲スタイル(`**kwargs`を使わないなど)を使う必要があります。これは、キーワード引数を分離した理由のひとつでもあります(詳しくは本記事末尾をご覧ください)。`ruby2_keywords`を用いれば、Ruby 2.7や3.0でも旧来の委譲スタイルを引き続き利用できます。2.6以前のRubyでは`ruby2_keywords`が定義されていないので、[ruby2_keywords](https://rubygems.org/gems/ruby2_keywords) gemを使うか、以下を手動で定義します。 {% highlight ruby %} def ruby2_keywords(*) end if RUBY_VERSION < "2.7" {% endhighlight %} ---- +* * * * * -If your code doesn't have to run on Ruby 2.6 or older, you may try the new style in Ruby 2.7. In almost all cases, it works. Note that, however, there are unfortunate corner cases as follows: +自分のコードがRuby 2.6以前で動かなくても構わないのであれば、Ruby 2.7で新しいスタイルを試してもよいでしょう。ほぼほぼ間違いなく動作しますが、以下のようなエッジケースを運悪く踏むこともあります。 {% highlight ruby %} def target(*args) @@ -178,35 +182,34 @@ def foo(*args, **kwargs, &block) target(*args, **kwargs, &block) end -foo({}) #=> Ruby 2.7: [] ({} is dropped) -foo({}, **{}) #=> Ruby 2.7: [{}] (You can pass {} by explicitly passing "no" keywords) +foo({}) #=> Ruby 2.7: [] ({}を含んでいない) +foo({}, **{}) #=> Ruby 2.7: [{}] ({}を渡せば、キーワード引数が「ない」ことを明示できる) {% endhighlight %} -An empty Hash argument is automatically converted and absorbed into `**kwargs`, and the delegation call removes the empty keyword hash, so no argument is passed to `target`. As far as we know, this is the only corner case. +上のコードでは、空のHash引数が自動的に変換されて`**kwargs`に吸い込まれ、この空のキーワードハッシュは委譲の呼び出しで削除されます。このため、`targe`には引数がまったく渡されなくなります。私たちが把握している範囲では、これが唯一のエッジケースです。 -As noted in the last line, you can work around this issue by using `**{}`. +上のコードの最下部に書いたように、`**{}`を渡すことでこの問題を回避できます。 -If you really worry about the portability, use `ruby2_keywords`. (Acknowledge that Ruby 2.6 or before themselves have tons of corner cases in keyword arguments. :-) -`ruby2_keywords` might be removed in the future after Ruby 2.6 reaches end-of-life. At that point, we recommend to explicitly delegate keyword arguments (see Ruby 3 code above). +移植性がどうしても不安な場合は`ruby2_keywords`をお使いください(Ruby 2.6以前ではキーワード引数周りで膨大なエッジケースが存在していることを知っておいてください)。`ruby2_keywords`は、今後Ruby 2.6が役目を終えたときに削除される可能性があります。現時点で私たちがおすすめできるのは、キーワード引数を明示的に委譲することです(上述のRuby 3向けのコードを参照)。 -## Other minor changes +## その他の微細な変更点 -There are three minor changes about keyword arguments in Ruby 2.7. +Ruby 2.7のキーワード引数では、この他に以下の3つのマイナーチェンジが行われています。 -### 1. Non-Symbol keys are allowed in keyword arguments +### 1\. キーワード引数で非シンボルキーを利用できるようになった -In Ruby 2.6 or before, only Symbol keys were allowed in keyword arguments. In Ruby 2.7, keyword arguments can use non-Symbol keys. +Ruby 2.6以前のキーワード引数では、シンボル形式のキーしか利用できませんでした。Ruby 2.7のキーワード引数では、以下のようにシンボル形式でないキーを利用できるようになります。 {% highlight ruby %} def foo(**kwargs) kwargs end foo("key" => 42) - #=> Ruby 2.6 or before: ArgumentError: wrong number of arguments - #=> Ruby 2.7 or later: {"key"=>42} + #=> Ruby 2.6以前: ArgumentError: wrong number of arguments + #=> Ruby 2.7以降: {"key"=>42} {% endhighlight %} -If a method accepts both optional and keyword arguments, the Hash object that has both Symbol keys and non-Symbol keys was split in two in Ruby 2.6. In Ruby 2.7, both are accepted as keywords because non-Symbol keys are allowed. +あるメソッドがオプション引数とキーワード引数を両方とも受け付ける場合、Ruby 2.6では以下のようにシンボル形式のキーと非シンボルキーを両方持つHashオブジェクトが2つに分割されていました。Ruby 2.7では非シンボルキーを利用できるので、どちらも受け取れます。 {% highlight ruby %} def bar(x=1, **kwargs) @@ -217,12 +220,12 @@ bar("key" => 42, :sym => 43) #=> Ruby 2.6: [{"key"=>42}, {:sym=>43}] #=> Ruby 2.7: [1, {"key"=>42, :sym=>43}] -# Use braces to keep the behavior +# 振る舞いを変えたくない場合は中かっこ{}を使う bar({"key" => 42}, :sym => 43) #=> Ruby 2.6 and 2.7: [{"key"=>42}, {:sym=>43}] {% endhighlight %} -Ruby 2.7 still splits hashes with a warning if passing a Hash or keyword arguments with both Symbol and non-Symbol keys to a method that accepts explicit keywords but no keyword rest argument (`**kwargs`). This behavior will be removed in Ruby 3, and an `ArgumentError` will be raised. +Ruby 2.7では、キーワード引数を明示的に受け付けるがキーワードrest引数(`**kwargs`)を受け取らないメソッドに対して、シンボル形式のキーと非シンボルキーが両方混じったHashやキーワード引数を渡すと、引き続きハッシュを分割して警告を表示します。この振る舞いはRuby 3で廃止されて`ArgumentError`にする予定です。 {% highlight ruby %} def bar(x=1, sym: nil) @@ -230,15 +233,15 @@ def bar(x=1, sym: nil) end bar("key" => 42, :sym => 43) -# Ruby 2.6 and 2.7: => [{"key"=>42}, 43] +# Ruby 2.6と2.7: => [{"key"=>42}, 43] # Ruby 2.7: warning: Splitting the last argument into positional and keyword parameters is deprecated # warning: The called method `bar' is defined here # Ruby 3.0: ArgumentError {% endhighlight %} -### 2. Double splat with an empty hash (`**{}`) passes no arguments +### 2\. double splatを付けた空ハッシュ(`**{}`)で引数を渡さないようになった -In Ruby 2.6 or before, passing `**empty_hash` passes an empty Hash as a positional argument. In Ruby 2.7 or later, it passes no arguments. +Ruby 2.6以前は、`**empty_hash`を渡すと位置引数に空のハッシュが渡されました(`[{}]`)。Ruby 2.7以降では引数を渡さなくなります。 {% highlight ruby %} def foo(*args) @@ -247,13 +250,13 @@ end empty_hash = {} foo(**empty_hash) - #=> Ruby 2.6 or before: [{}] - #=> Ruby 2.7 or later: [] + #=> Ruby 2.6以前: [{}] + #=> Ruby 2.7以降: [] {% endhighlight %} -Note that `foo(**{})` passes nothing in both Ruby 2.6 and 2.7. In Ruby 2.6 and before, `**{}` is removed by the parser, and in Ruby 2.7 and above, it is treated the same as `**empty_hash`, allowing for an easy way to pass no keyword arguments to a method. +なお、`foo(**{})`はRuby 2.6以前とRuby 2.7のどちらの場合も引数を渡さず、`**{}`がパーサーによって削除される点にご注意ください。また、Ruby 2.7以降ではどちらも`**empty_hash`として同じに扱われるので、メソッドにキーワード引数を渡さないようにする指定が楽に行なえます。 -In Ruby 2.7, when calling a method with an insufficient number of required positional arguments, `foo(**empty_hash)` passes an empty hash with a warning emitted, for compatibility with Ruby 2.6. This behavior will be removed in 3.0. +Ruby 2.7では、あるメソッド呼び出しで必須とされる位置引数の個数が不足している場合、Ruby 2.6との互換性を保つために`foo(**empty_hash)`は空のハッシュを渡してwarningを表示します。この振る舞いはRuby 3.0で廃止されます。 {% highlight ruby %} def foo(x) @@ -262,51 +265,51 @@ end empty_hash = {} foo(**empty_hash) - #=> Ruby 2.6 or before: {} + #=> Ruby 2.6以前: {} #=> Ruby 2.7: warning: Passing the keyword argument as the last hash parameter is deprecated # warning: The called method `foo' is defined here #=> Ruby 3.0: ArgumentError: wrong number of arguments {% endhighlight %} -### 3. The no-keyword-arguments syntax (`**nil`) is introduced +### 3\. キーワード引数を受け取らないことを表す構文(`**nil`)が導入される -You can use `**nil` in a method definition to explicitly mark the method accepts no keyword arguments. Calling such methods with keyword arguments will result in an `ArgumentError`. (This is actually a new feature, not an incompatibility) +メソッド定義で`**nil`を用いることで、そのメソッドがキーワード引数を受け取らないことを明示的に示せるようになります。このメソッドを呼び出すときにキーワード引数を渡すと`ArgumentError`が表示されます(これは非互換性ではなく、事実上新機能です)。 {% highlight ruby %} def foo(*args, **nil) end foo(k: 1) - #=> Ruby 2.7 or later: no keywords accepted (ArgumentError) + #=> Ruby 2.7以降: no keywords accepted (ArgumentError) {% endhighlight %} -This is useful to make it explicit that the method does not accept keyword arguments. Otherwise, the keywords are absorbed in the rest argument in the above example. If you extend a method to accept keyword arguments, the method may have incompatibility as follows: +この新構文は、メソッドがキーワード引数を受け取らないことを明示的に指定するのに有用です。これを使わない場合、キーワード引数は上述の例の他の引数に吸い込まれます。メソッドを拡張してキーワード引数を受け取るようにする場合、以下のような非互換性が発生する可能性があります。 {% highlight ruby %} -# If a method accepts rest argument and no `**nil` +# メソッドは残りの引数を受け取るが、`**nil`はない状態 def foo(*args) p args end -# Passing keywords are converted to a Hash object (even in Ruby 3.0) +# キーワード引数はHashオブジェクトに変換される(Ruby 3.0でも同じ) foo(k: 1) #=> [{:k=>1}] -# If the method is extended to accept a keyword +# メソッドがキーワード引数を受け取るよう拡張した場合 def foo(*args, mode: false) p args end -# The existing call may break +# 以下の呼び出しが壊れる可能性がある foo(k: 1) #=> ArgumentError: unknown keyword k {% endhighlight %} -## Why we're deprecating the automatic conversion +## 自動変換を非推奨に変える理由 -The automatic conversion initially appeared to be a good idea, and worked well in many cases. However, it had too many corner cases, and we have received many bug reports about the behavior. +当初、自動変換はうまいアイデアに思われていて、多くの場合問題なく機能していました。しかし、エッジケースがあまりにも多く、これまでこの振る舞いに関するバグレポートを山のように受け取りました。 -Automatic conversion does not work well when a method accepts optional positional arguments and keyword arguments. Some people expect the last Hash object to be treated as a positional argument, and others expect it to be converted to keyword arguments. +自動変換は、オプションの位置引数とキーワード引数をどちらも受け取るメソッドではうまく動きません。末尾のHashオブジェクトを位置引数として扱うことを期待する人々もいれば、末尾のHashオブジェクトをキーワード引数として扱うことを期待する人々もいました。 -Here is one of the most confusing cases: +最も混乱を呼ぶケースのひとつを以下に示します。 {% highlight ruby %} def foo(x, **kwargs) @@ -317,17 +320,17 @@ def bar(x=1, **kwargs) p [x, kwargs] end -foo({}) => [{}, {}] -bar({}) => [1, {}] +foo({}) #=> [{}, {}] +bar({}) #=> [1, {}] -bar({}, **{}) => expected: [{}, {}], actual: [1, {}] +bar({}, **{}) #=> 期待は: [{}, {}]だが実際はl: [1, {}] {% endhighlight %} -In Ruby 2, `foo({})` passes an empty hash as a normal argument (i.e., `{}` is assigned to `x`), while `bar({})` passes a keyword argument (i.e, `{}` is assigned to `kwargs`). So `any_method({})` is very ambiguous. +Ruby 2の場合、`foo({})`は空のハッシュを通常の引数として1つ渡しますが(`x`に`{}`が代入されるなど)、`bar({})`はキーワード引数を1つ渡します(`kwargs`に`{}`が代入されるなど)。つまり、`any_method({})`は極めてあいまいになります。 -You may think of `bar({}, **{})` to pass the empty hash to `x` explicitly. Surprisingly, it does not work as you expected; it still prints `[1, {}]` in Ruby 2.6. This is because `**{}` is ignored by the parser in Ruby 2.6, and the first argument `{}` is automatically converted to keywords (`**kwargs`). In this case, you need to call `bar({}, {})`, which is very weird. +「`bar({}, **{})`は`x`に明示的に空のハッシュを渡すのでは?」と考える人もいるかもしれませんが、驚いたことに、この期待は裏切られます。Ruby 2.6では`[1, {}]`が出力されるのです。理由は、`**{}`がRuby 2.6のパーサーで無視されるのと、1番目の引数`{}`が自動的にキーワード引数(`**kwargs`)に変換されるためです。この場合`bar({}, {})`という形で呼び出す必要がありますが、これではあまりに見苦しくなります。 -The same issues also apply to methods that accept rest and keyword arguments. This makes explicit delegation of keyword arguments not work. +同じ問題は、残りの引数とキーワード引数を受け取るメソッドにも当てはまります。そのせいで、以下のようなキーワード引数の明示的な委譲は動作しません。 {% highlight ruby %} def target(*args) @@ -338,18 +341,18 @@ def foo(*args, **kwargs, &block) target(*args, **kwargs, &block) end -foo() #=> Ruby 2.6 or before: [{}] - #=> Ruby 2.7 or later: [] +foo() #=> Ruby 2.6以前: [{}] + #=> Ruby 2.7以降: [] {% endhighlight %} -`foo()` passes no arguments, but `target` receives an empty hash argument in Ruby 2.6. This is because the method `foo` delegates keywords (`**kwargs`) explicitly. When `foo()` is called, `args` is an empty Array, `kwargs` is an empty Hash, and `block` is `nil`. And then `target(*args, **kwargs, &block)` passes an empty Hash as an argument because `**kwargs` is automatically converted to a positional Hash argument. +`foo()`には引数がありませんが、Ruby 2.6では空のハッシュ引数が`target`に渡されます。理由は、メソッド`foo`が明示的にキーワード(`**kwargs`)を委譲しているためです。`foo()`が呼び出されると、`args`は空のArrayになり、`kwargs`は空のHashになります。そして`target(*args, **kwargs, &block)`は空のHashを引数として1つ渡します。理由は、`**kwargs`が自動的にHash位置引数に変換されるためです。 -The automatic conversion not only confuses people but also makes the method less extensible. See [[Feature #14183]](https://bugs.ruby-lang.org/issues/14183) for more details about the reasons for the change in behavior, and why certain implementation choices were made. +自動変換は開発者を混乱させるのみならず、メソッドの拡張性も弱めてしまいます。振る舞いが変更された理由や、特定の実装が選択された理由について詳しくは[Feature #14183](https://bugs.ruby-lang.org/issues/14183)をご覧ください。 -## Acknowledgment +## 謝辞 -This article was kindly reviewed (or even co-authored) by Jeremy Evans and Benoit Daloze. +本記事はJeremy EvansとBenoit Dalozeによる丁寧なレビュー(共著と言ってもよいくらいです)をいただきました。 -## History +## 更新履歴 -* Updated 2019-12-25: In 2.7.0-rc2, the warning message was slightly changed, and an API to suppress the warnings was added. +* 更新 2019-12-25: 2.7.0-rc2でwarningメッセージが若干変更され、warning抑制APIが追加された。 From c82970710444b36e5baf1f6315b388d809062b1a Mon Sep 17 00:00:00 2001 From: hachi8833 Date: Thu, 30 Jan 2020 16:49:40 +0900 Subject: [PATCH 0086/1090] Fix untranslated lines --- ...ation-of-positional-and-keyword-arguments-in-ruby-3-0.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ja/news/_posts/2019-12-12-separation-of-positional-and-keyword-arguments-in-ruby-3-0.md b/ja/news/_posts/2019-12-12-separation-of-positional-and-keyword-arguments-in-ruby-3-0.md index 5e80e231d5..b9aec21a12 100644 --- a/ja/news/_posts/2019-12-12-separation-of-positional-and-keyword-arguments-in-ruby-3-0.md +++ b/ja/news/_posts/2019-12-12-separation-of-positional-and-keyword-arguments-in-ruby-3-0.md @@ -1,6 +1,6 @@ --- layout: news_post -title: "Separation of positional and keyword arguments in Ruby 3.0" +title: "Ruby 3.0における位置引数とキーワード引数の分離について" author: "mame" translator: "hachi8833" date: 2019-12-12 12:00:00 +0000 @@ -13,8 +13,8 @@ lang: ja Ruby 3.0では、位置引数とキーワード引数が分離されます。Ruby 3.0で変更される振る舞いはRuby 2.7でwarningを表示します。以下のいずれかのwarningが表示される場合は、コードのアップデートが必要です。 -* `Using the last argument as keyword parameters is deprecated`, or -* `Passing the keyword argument as the last hash parameter is deprecated`, or +* `Using the last argument as keyword parameters is deprecated` +* `Passing the keyword argument as the last hash parameter is deprecated` * `Splitting the last argument into positional and keyword parameters is deprecated` この非互換性は、double splat演算子(`**`)を追加することでほぼ回避できます。これにより、`Hash`オブジェクトではなくキーワード引数を渡すことが明示的に指定されます。同様に、キーワード引数ではなく`Hash`オブジェクトを明示的に渡したい場合は中かっこ(`{}`)を追加できます。詳しくは後述の「典型的なケース」をご覧ください。 From db32bd844eff125ad3ddd8e47a6ee8285f3c57b1 Mon Sep 17 00:00:00 2001 From: jinroq <2787780+jinroq@users.noreply.github.com> Date: Sat, 27 Nov 2021 00:48:28 +0900 Subject: [PATCH 0087/1090] Revised the points pointed out in the review. --- ...ional-and-keyword-arguments-in-ruby-3-0.md | 34 ++++++++++--------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/ja/news/_posts/2019-12-12-separation-of-positional-and-keyword-arguments-in-ruby-3-0.md b/ja/news/_posts/2019-12-12-separation-of-positional-and-keyword-arguments-in-ruby-3-0.md index b9aec21a12..38c2aea1c9 100644 --- a/ja/news/_posts/2019-12-12-separation-of-positional-and-keyword-arguments-in-ruby-3-0.md +++ b/ja/news/_posts/2019-12-12-separation-of-positional-and-keyword-arguments-in-ruby-3-0.md @@ -11,7 +11,9 @@ lang: ja ## 概要 -Ruby 3.0では、位置引数とキーワード引数が分離されます。Ruby 3.0で変更される振る舞いはRuby 2.7でwarningを表示します。以下のいずれかのwarningが表示される場合は、コードのアップデートが必要です。 +この文書では便宜上、必須引数、オプション引数、rest引数、後置引数(つまり、キーワード引数とブロック引数以外の引数)をまとめて「位置引数」と呼びます。 + +Ruby 3.0では、位置引数とキーワード引数が分離されます。Ruby 3.0で変更される振る舞いはRuby 2.7で警告を表示します。以下のいずれかの警告が表示される場合は、コードのアップデートが必要です。 * `Using the last argument as keyword parameters is deprecated` * `Passing the keyword argument as the last hash parameter is deprecated` @@ -100,13 +102,13 @@ foo(k: 1) #=> {:k=>1} ## Q: 自分のコードはRuby 2.7で動かなくなりますか? -手短かに言うと「壊れない可能性はあります」。 +A: たぶん動きます。 -Ruby 2.7におけるこの変更は、3.0への移行パスとして設計されています。あくまで原則としてですが、Ruby 2.7ではRuby 3.0で変更される振る舞いについてwarningを出すにとどめており、warningの中には私たちが微細とみなしている変更点も若干含まれます。詳しくは後述の「その他の微細な変更点」をご覧ください。 +Ruby 2.7では、原則として、Ruby 3.0で変更される振る舞いについて警告を出すにとどめています。しかし、私たちが軽微とみなした非互換も少しだけ入っています。詳しくは後述の「その他の軽微な変更点」をご覧ください。 -Ruby 2.7では、warningが表示される点と微細な変更点以外を除いてRuby 2.6との互換性を保とうとしています。つまり、あなたのコードはRuby 2.7でもおそらく動作しますが、warningが表示される可能性はあります。あなたのコードをRuby 2.7で実行すれば、Ruby 3.0の準備ができているかどうかをチェックできます。 +Ruby 2.7では、警告が表示される点と軽微な変更点以外を除いてRuby 2.6との互換性を保とうとしています。つまり、あなたのコードはRuby 2.7でもおそらく動作しますが、警告が表示される可能性はあります。あなたのコードをRuby 2.7で実行すれば、Ruby 3.0の準備ができているかどうかをチェックできます。 -非推奨のwarningを無効にしたい場合は、コマンドライン引数`-W:no-deprecated`を使うか、コードに`Warning[:deprecated] = false`を追加します。 +非推奨の警告を無効にしたい場合は、コマンドライン引数`-W:no-deprecated`を使うか、コードに`Warning[:deprecated] = false`を追加します。 ## 引数の委譲の扱いについて @@ -162,7 +164,7 @@ ruby2_keywords def foo(*args, &block) end {% endhighlight %} -残念ながら、Ruby 2.6以前では新しい委譲スタイルを正しく扱えないため、旧来の委譲スタイル(`**kwargs`を使わないなど)を使う必要があります。これは、キーワード引数を分離した理由のひとつでもあります(詳しくは本記事末尾をご覧ください)。`ruby2_keywords`を用いれば、Ruby 2.7や3.0でも旧来の委譲スタイルを引き続き利用できます。2.6以前のRubyでは`ruby2_keywords`が定義されていないので、[ruby2_keywords](https://rubygems.org/gems/ruby2_keywords) gemを使うか、以下を手動で定義します。 +残念ながら、Ruby 2.6以前では新しい委譲スタイルを正しく扱えないため、旧来の委譲スタイル(つまり、**kwargsを受け渡ししないスタイル)を使う必要があります。これは、キーワード引数を分離した理由のひとつでもあります(詳しくは本記事末尾をご覧ください)。`ruby2_keywords`を用いれば、Ruby 2.7や3.0でも旧来の委譲スタイルを引き続き利用できます。2.6以前のRubyでは`ruby2_keywords`が定義されていないので、[ruby2_keywords](https://rubygems.org/gems/ruby2_keywords) gemを使うか、以下を手動で定義します。 {% highlight ruby %} def ruby2_keywords(*) @@ -186,15 +188,15 @@ foo({}) #=> Ruby 2.7: [] ({}を含んでいない) foo({}, **{}) #=> Ruby 2.7: [{}] ({}を渡せば、キーワード引数が「ない」ことを明示できる) {% endhighlight %} -上のコードでは、空のHash引数が自動的に変換されて`**kwargs`に吸い込まれ、この空のキーワードハッシュは委譲の呼び出しで削除されます。このため、`targe`には引数がまったく渡されなくなります。私たちが把握している範囲では、これが唯一のエッジケースです。 +上のコードでは、空のHash引数が自動的に変換されて`**kwargs`に吸い込まれ、この空のキーワードハッシュは委譲の呼び出しで削除されます。このため、`target`には引数がまったく渡されなくなります。私たちが把握している範囲では、これが唯一のエッジケースです。 上のコードの最下部に書いたように、`**{}`を渡すことでこの問題を回避できます。 -移植性がどうしても不安な場合は`ruby2_keywords`をお使いください(Ruby 2.6以前ではキーワード引数周りで膨大なエッジケースが存在していることを知っておいてください)。`ruby2_keywords`は、今後Ruby 2.6が役目を終えたときに削除される可能性があります。現時点で私たちがおすすめできるのは、キーワード引数を明示的に委譲することです(上述のRuby 3向けのコードを参照)。 +移植性がどうしても不安な場合は`ruby2_keywords`をお使いください(Ruby 2.6以前ではキーワード引数周りで膨大なエッジケースが存在していることを知っておいてください)。`ruby2_keywords`は、今後Ruby 2.6がサポート切れになったあとで削除される可能性があります。そのときになったら、キーワード引数を明示的に委譲することをおすすめします(上述のRuby 3向けのコードを参照)。 -## その他の微細な変更点 +## その他の軽微な変更点 -Ruby 2.7のキーワード引数では、この他に以下の3つのマイナーチェンジが行われています。 +Ruby 2.7のキーワード引数では、この他に以下の3つの軽微な変更が行われています。 ### 1\. キーワード引数で非シンボルキーを利用できるようになった @@ -256,7 +258,7 @@ foo(**empty_hash) なお、`foo(**{})`はRuby 2.6以前とRuby 2.7のどちらの場合も引数を渡さず、`**{}`がパーサーによって削除される点にご注意ください。また、Ruby 2.7以降ではどちらも`**empty_hash`として同じに扱われるので、メソッドにキーワード引数を渡さないようにする指定が楽に行なえます。 -Ruby 2.7では、あるメソッド呼び出しで必須とされる位置引数の個数が不足している場合、Ruby 2.6との互換性を保つために`foo(**empty_hash)`は空のハッシュを渡してwarningを表示します。この振る舞いはRuby 3.0で廃止されます。 +Ruby 2.7では、あるメソッド呼び出しで必須とされる位置引数の個数が不足している場合、Ruby 2.6との互換性を保つために`foo(**empty_hash)`は空のハッシュを渡して警告を表示します。この振る舞いはRuby 3.0で廃止されます。 {% highlight ruby %} def foo(x) @@ -273,7 +275,7 @@ foo(**empty_hash) ### 3\. キーワード引数を受け取らないことを表す構文(`**nil`)が導入される -メソッド定義で`**nil`を用いることで、そのメソッドがキーワード引数を受け取らないことを明示的に示せるようになります。このメソッドを呼び出すときにキーワード引数を渡すと`ArgumentError`が表示されます(これは非互換性ではなく、事実上新機能です)。 +メソッド定義で`**nil`を用いることで、そのメソッドがキーワード引数を受け取らないことを明示的に示せるようになります。このメソッドを呼び出すときにキーワード引数を渡すと`ArgumentError`が表示されます(これは非互換性ではなく、新機能です)。 {% highlight ruby %} def foo(*args, **nil) @@ -283,7 +285,7 @@ foo(k: 1) #=> Ruby 2.7以降: no keywords accepted (ArgumentError) {% endhighlight %} -この新構文は、メソッドがキーワード引数を受け取らないことを明示的に指定するのに有用です。これを使わない場合、キーワード引数は上述の例の他の引数に吸い込まれます。メソッドを拡張してキーワード引数を受け取るようにする場合、以下のような非互換性が発生する可能性があります。 +この新構文は、メソッドがキーワード引数を受け取らないことを明示的に指定するのに有用です。これを使わない場合、キーワード引数は上述の例のrest引数に吸い込まれます。メソッドを拡張してキーワード引数を受け取るようにする場合、以下のような非互換性が発生する可能性があります。 {% highlight ruby %} # メソッドは残りの引数を受け取るが、`**nil`はない状態 @@ -307,7 +309,7 @@ foo(k: 1) #=> ArgumentError: unknown keyword k 当初、自動変換はうまいアイデアに思われていて、多くの場合問題なく機能していました。しかし、エッジケースがあまりにも多く、これまでこの振る舞いに関するバグレポートを山のように受け取りました。 -自動変換は、オプションの位置引数とキーワード引数をどちらも受け取るメソッドではうまく動きません。末尾のHashオブジェクトを位置引数として扱うことを期待する人々もいれば、末尾のHashオブジェクトをキーワード引数として扱うことを期待する人々もいました。 +自動変換は、オプション引数とキーワード引数をどちらも受け取るメソッドではうまく動きません。末尾のHashオブジェクトを位置引数として扱うことを期待する人々もいれば、末尾のHashオブジェクトをキーワード引数として扱うことを期待する人々もいました。 最も混乱を呼ぶケースのひとつを以下に示します。 @@ -345,7 +347,7 @@ foo() #=> Ruby 2.6以前: [{}] #=> Ruby 2.7以降: [] {% endhighlight %} -`foo()`には引数がありませんが、Ruby 2.6では空のハッシュ引数が`target`に渡されます。理由は、メソッド`foo`が明示的にキーワード(`**kwargs`)を委譲しているためです。`foo()`が呼び出されると、`args`は空のArrayになり、`kwargs`は空のHashになります。そして`target(*args, **kwargs, &block)`は空のHashを引数として1つ渡します。理由は、`**kwargs`が自動的にHash位置引数に変換されるためです。 +`foo()`には引数がありませんが、Ruby 2.6では空のハッシュ引数が`target`に渡されます。理由は、メソッド`foo`が明示的にキーワード(`**kwargs`)を委譲しているためです。`foo()`が呼び出されると、`args`は空のArrayになり、`kwargs`は空のHashになり、blockはnilになります。。そして`target(*args, **kwargs, &block)`は空のHashを引数として1つ渡します。理由は、`**kwargs`が自動的にHash位置引数に変換されるためです。 自動変換は開発者を混乱させるのみならず、メソッドの拡張性も弱めてしまいます。振る舞いが変更された理由や、特定の実装が選択された理由について詳しくは[Feature #14183](https://bugs.ruby-lang.org/issues/14183)をご覧ください。 @@ -355,4 +357,4 @@ foo() #=> Ruby 2.6以前: [{}] ## 更新履歴 -* 更新 2019-12-25: 2.7.0-rc2でwarningメッセージが若干変更され、warning抑制APIが追加された。 +* 更新 2019-12-25: 2.7.0-rc2で警告メッセージが若干変更され、警告抑制APIが追加された。 From a5f8fdd3ea5cd14267b1d9cc7efc3d208447de8a Mon Sep 17 00:00:00 2001 From: hachi8833 Date: Wed, 22 Jan 2020 12:35:17 +0900 Subject: [PATCH 0088/1090] Add en doc --- ...separation-of-positional-and-keyword-arguments-in-ruby-3-0.md | 1 + 1 file changed, 1 insertion(+) diff --git a/ja/news/_posts/2019-12-12-separation-of-positional-and-keyword-arguments-in-ruby-3-0.md b/ja/news/_posts/2019-12-12-separation-of-positional-and-keyword-arguments-in-ruby-3-0.md index 38c2aea1c9..505003747d 100644 --- a/ja/news/_posts/2019-12-12-separation-of-positional-and-keyword-arguments-in-ruby-3-0.md +++ b/ja/news/_posts/2019-12-12-separation-of-positional-and-keyword-arguments-in-ruby-3-0.md @@ -174,6 +174,7 @@ end if RUBY_VERSION < "2.7" * * * * * 自分のコードがRuby 2.6以前で動かなくても構わないのであれば、Ruby 2.7で新しいスタイルを試してもよいでしょう。ほぼほぼ間違いなく動作しますが、以下のようなエッジケースを運悪く踏むこともあります。 +--- {% highlight ruby %} def target(*args) From bdd3514fe2b0a6a4e52ae311b93d39f462f9ac87 Mon Sep 17 00:00:00 2001 From: hachi8833 Date: Wed, 22 Jan 2020 12:35:47 +0900 Subject: [PATCH 0089/1090] Translate "Separation of positional and keyword arguments in Ruby 3.0" --- ...paration-of-positional-and-keyword-arguments-in-ruby-3-0.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ja/news/_posts/2019-12-12-separation-of-positional-and-keyword-arguments-in-ruby-3-0.md b/ja/news/_posts/2019-12-12-separation-of-positional-and-keyword-arguments-in-ruby-3-0.md index 505003747d..234c6671db 100644 --- a/ja/news/_posts/2019-12-12-separation-of-positional-and-keyword-arguments-in-ruby-3-0.md +++ b/ja/news/_posts/2019-12-12-separation-of-positional-and-keyword-arguments-in-ruby-3-0.md @@ -13,6 +13,8 @@ lang: ja この文書では便宜上、必須引数、オプション引数、rest引数、後置引数(つまり、キーワード引数とブロック引数以外の引数)をまとめて「位置引数」と呼びます。 +Ruby 3.0では、位置引数とキーワード引数が分離されます。Ruby 3.0で変更される振る舞いはRuby 2.7でwarningを表示します。以下のいずれかのwarningが表示される場合は、コードのアップデートが必要です。 + Ruby 3.0では、位置引数とキーワード引数が分離されます。Ruby 3.0で変更される振る舞いはRuby 2.7で警告を表示します。以下のいずれかの警告が表示される場合は、コードのアップデートが必要です。 * `Using the last argument as keyword parameters is deprecated` @@ -174,7 +176,6 @@ end if RUBY_VERSION < "2.7" * * * * * 自分のコードがRuby 2.6以前で動かなくても構わないのであれば、Ruby 2.7で新しいスタイルを試してもよいでしょう。ほぼほぼ間違いなく動作しますが、以下のようなエッジケースを運悪く踏むこともあります。 ---- {% highlight ruby %} def target(*args) From d1d39723a179d9f0e97329bb48786981c8147c54 Mon Sep 17 00:00:00 2001 From: hachi8833 Date: Thu, 30 Jan 2020 16:49:40 +0900 Subject: [PATCH 0090/1090] Fix untranslated lines --- ...eparation-of-positional-and-keyword-arguments-in-ruby-3-0.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/ja/news/_posts/2019-12-12-separation-of-positional-and-keyword-arguments-in-ruby-3-0.md b/ja/news/_posts/2019-12-12-separation-of-positional-and-keyword-arguments-in-ruby-3-0.md index 234c6671db..38c2aea1c9 100644 --- a/ja/news/_posts/2019-12-12-separation-of-positional-and-keyword-arguments-in-ruby-3-0.md +++ b/ja/news/_posts/2019-12-12-separation-of-positional-and-keyword-arguments-in-ruby-3-0.md @@ -13,8 +13,6 @@ lang: ja この文書では便宜上、必須引数、オプション引数、rest引数、後置引数(つまり、キーワード引数とブロック引数以外の引数)をまとめて「位置引数」と呼びます。 -Ruby 3.0では、位置引数とキーワード引数が分離されます。Ruby 3.0で変更される振る舞いはRuby 2.7でwarningを表示します。以下のいずれかのwarningが表示される場合は、コードのアップデートが必要です。 - Ruby 3.0では、位置引数とキーワード引数が分離されます。Ruby 3.0で変更される振る舞いはRuby 2.7で警告を表示します。以下のいずれかの警告が表示される場合は、コードのアップデートが必要です。 * `Using the last argument as keyword parameters is deprecated` From 8b1e350ead504e7d804b7b44dfa2669cd56e2fab Mon Sep 17 00:00:00 2001 From: jinroq <2787780+jinroq@users.noreply.github.com> Date: Mon, 29 Nov 2021 10:40:13 +0900 Subject: [PATCH 0091/1090] Added some changes that we consider to minor. --- ...ositional-and-keyword-arguments-in-ruby-3-0.md | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/ja/news/_posts/2019-12-12-separation-of-positional-and-keyword-arguments-in-ruby-3-0.md b/ja/news/_posts/2019-12-12-separation-of-positional-and-keyword-arguments-in-ruby-3-0.md index 38c2aea1c9..ac24a4a40e 100644 --- a/ja/news/_posts/2019-12-12-separation-of-positional-and-keyword-arguments-in-ruby-3-0.md +++ b/ja/news/_posts/2019-12-12-separation-of-positional-and-keyword-arguments-in-ruby-3-0.md @@ -24,6 +24,7 @@ Ruby 3.0では、位置引数とキーワード引数が分離されます。Rub Ruby 3では、すべての引数を委譲するメソッドで、位置引数の他に必ずキーワード引数も明示的に委譲しなければなりません。Ruby 2.7以前の委譲の振る舞いを変えたくない場合は、`ruby2_keywords`をお使いください。詳しくは後述の「引数の委譲の扱いについて」をご覧ください。 ## よくあるケース +{: #typical-cases } 以下はもっともよくあるケースです。Hashではなくキーワードを渡すのにdouble splat演算子(`**`)を使えます。 @@ -69,6 +70,7 @@ bar({ k: 42 }) # => {:k=>42} {% endhighlight %} ## どの動作が非推奨になるか +{: #what-is-deprecated } Ruby 2では、キーワード引数が末尾のハッシュ位置引数として扱われることがあります。また、末尾のハッシュ引数がキーワード引数として扱われることもあります。 @@ -101,6 +103,7 @@ foo(k: 1) #=> {:k=>1} {% endhighlight %} ## Q: 自分のコードはRuby 2.7で動かなくなりますか? +{: #break-on-ruby-2-7 } A: たぶん動きます。 @@ -111,8 +114,10 @@ Ruby 2.7では、警告が表示される点と軽微な変更点以外を除い 非推奨の警告を無効にしたい場合は、コマンドライン引数`-W:no-deprecated`を使うか、コードに`Warning[:deprecated] = false`を追加します。 ## 引数の委譲の扱いについて +{: #delegation } ### Ruby 2.6以前の場合 +{: #delegation-ruby-2-6-or-prior } Ruby 2では、以下のように1個の`*rest`引数と1個の`&block`引数を受け付けて、この2つの引数を委譲先メソッド(以下の`target`)に渡すことで委譲メソッドを書けます。この振る舞いでは、(1つ以上の)キーワード引数も「位置引数<=>キーワード引数の自動変換」によって暗黙的に扱われます。 @@ -123,6 +128,7 @@ end {% endhighlight %} ### Ruby 3の場合 +{: #delegation-ruby-3 } 以下のようにキーワード引数を明示的に委譲する必要があります。 @@ -141,6 +147,7 @@ end {% endhighlight %} ### Ruby 2.7の場合 +{: #delegation-ruby-2-7 } 手短かに言うと、以下のように`Module#ruby2_keywords`を用い、`*args, &block`を委譲します。 @@ -155,6 +162,7 @@ end 実際、Ruby 2.7では多くの場面でこの新しい委譲のスタイルを利用できます。ただし1つ既知のエッジケースがあります。次をご覧ください。 ### Ruby 2.6 / 2.7 / 3で互換性のある委譲スタイル +{: #a-compatible-delegation } 手短かに言うと、ここも「`Module#ruby2_keywords`を使う」となります。 @@ -171,7 +179,7 @@ def ruby2_keywords(*) end if RUBY_VERSION < "2.7" {% endhighlight %} -* * * * * +--- 自分のコードがRuby 2.6以前で動かなくても構わないのであれば、Ruby 2.7で新しいスタイルを試してもよいでしょう。ほぼほぼ間違いなく動作しますが、以下のようなエッジケースを運悪く踏むこともあります。 @@ -195,10 +203,12 @@ foo({}, **{}) #=> Ruby 2.7: [{}] ({}を渡せば、キーワード引数が「 移植性がどうしても不安な場合は`ruby2_keywords`をお使いください(Ruby 2.6以前ではキーワード引数周りで膨大なエッジケースが存在していることを知っておいてください)。`ruby2_keywords`は、今後Ruby 2.6がサポート切れになったあとで削除される可能性があります。そのときになったら、キーワード引数を明示的に委譲することをおすすめします(上述のRuby 3向けのコードを参照)。 ## その他の軽微な変更点 +{: #other-minor-changes } Ruby 2.7のキーワード引数では、この他に以下の3つの軽微な変更が行われています。 ### 1\. キーワード引数で非シンボルキーを利用できるようになった +{: #other-minor-changes-non-symbol-keys } Ruby 2.6以前のキーワード引数では、シンボル形式のキーしか利用できませんでした。Ruby 2.7のキーワード引数では、以下のようにシンボル形式でないキーを利用できるようになります。 @@ -242,6 +252,7 @@ bar("key" => 42, :sym => 43) {% endhighlight %} ### 2\. double splatを付けた空ハッシュ(`**{}`)で引数を渡さないようになった +{: #other-minor-changes-empty-hash } Ruby 2.6以前は、`**empty_hash`を渡すと位置引数に空のハッシュが渡されました(`[{}]`)。Ruby 2.7以降では引数を渡さなくなります。 @@ -274,6 +285,7 @@ foo(**empty_hash) {% endhighlight %} ### 3\. キーワード引数を受け取らないことを表す構文(`**nil`)が導入される +{: #other-minor-changes-double-splat-nil } メソッド定義で`**nil`を用いることで、そのメソッドがキーワード引数を受け取らないことを明示的に示せるようになります。このメソッドを呼び出すときにキーワード引数を渡すと`ArgumentError`が表示されます(これは非互換性ではなく、新機能です)。 @@ -306,6 +318,7 @@ foo(k: 1) #=> ArgumentError: unknown keyword k {% endhighlight %} ## 自動変換を非推奨に変える理由 +{: #why-deprecated } 当初、自動変換はうまいアイデアに思われていて、多くの場合問題なく機能していました。しかし、エッジケースがあまりにも多く、これまでこの振る舞いに関するバグレポートを山のように受け取りました。 From 43feb73e0af06667ddbb9a695972fe019fc00a57 Mon Sep 17 00:00:00 2001 From: Andrias Meisyal Date: Sat, 27 Nov 2021 21:07:05 +0700 Subject: [PATCH 0092/1090] Translate CVE-2021-31810: Trusting FTP PASV responses vulnerability in Net::FTP (id) --- ...7-07-trusting-pasv-responses-in-net-ftp.md | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 id/news/_posts/2021-07-07-trusting-pasv-responses-in-net-ftp.md diff --git a/id/news/_posts/2021-07-07-trusting-pasv-responses-in-net-ftp.md b/id/news/_posts/2021-07-07-trusting-pasv-responses-in-net-ftp.md new file mode 100644 index 0000000000..6dad71eca8 --- /dev/null +++ b/id/news/_posts/2021-07-07-trusting-pasv-responses-in-net-ftp.md @@ -0,0 +1,40 @@ +--- +layout: news_post +title: "CVE-2021-31810: Kerentanan respons FTP PASV yang dipercaya pada Net::FTP" +author: "shugo" +translator: "meisyal" +date: 2021-07-07 09:00:00 +0000 +tags: security +lang: id +--- + +Sebuah kerentanan respons FTP PASV yang dipercaya telah ditemukan pada Net::FTP. +Kerentanan ini telah ditetapkan dengan penanda CVE +[CVE-2021-31810](https://nvd.nist.gov/vuln/detail/CVE-2021-31810). +Kami sangat merekomendasikan Anda untuk memperbarui Ruby. + +net-ftp adalah sebuah *default gem* pada Ruby 3.0.1, tetapi *gem* tersebut +memiliki masalah pengemasan. Sehingga, mohon perbarui Ruby. + +## Detail + +Sebuah FTP *server* yang berbahaya dapat menggunakan respons PASV untuk +mengelabui Net::FTP dengan menghubungkan kembali ke sebuah alamat IP dan *port* +yang diberikan. Ini berpotensi membuat Net::FTP menguraikan informasi *service* +yang seharusnya privat dan tidak boleh terbuka (contohnya, penyerang melakukan +*port scan* dan *service banner extraction*). + +## Versi Terimbas + +* Rangkaian Ruby 2.6: 2.6.7 dan sebelumnya +* Rangkaian Ruby 2.7: 2.7.3 dan sebelumnya +* Rangkaian Ruby 3.0: 3.0.1 dan sebelumnya + +## Rujukan + +Terima kasih kepada [Alexandr Savca](https://hackerone.com/chinarulezzz) yang +telah melaporkan kerentanan ini. + +## Riwayat + +* Semula dipublikasikan pada 2021-07-07 09:00:00 UTC From 568fbdc9322ab3d5f91c9938af05a890841ead65 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladimir=20T=C3=A1mara=20Pati=C3=B1o?= Date: Thu, 2 Dec 2021 09:48:22 -0500 Subject: [PATCH 0093/1090] Translation of Ruby 3.1.0-preview1 releases (es) (#2736) --- ...2021-11-09-ruby-3-1-0-preview1-released.md | 259 ++++++++++++++++++ 1 file changed, 259 insertions(+) create mode 100644 es/news/_posts/2021-11-09-ruby-3-1-0-preview1-released.md diff --git a/es/news/_posts/2021-11-09-ruby-3-1-0-preview1-released.md b/es/news/_posts/2021-11-09-ruby-3-1-0-preview1-released.md new file mode 100644 index 0000000000..6bbecd9013 --- /dev/null +++ b/es/news/_posts/2021-11-09-ruby-3-1-0-preview1-released.md @@ -0,0 +1,259 @@ +--- +layout: news_post +title: "Publicado Ruby 3.1.0 versión previa 1" +author: "naruse" +translator: vtamara +date: 2021-11-09 00:00:00 +0000 +lang: es +--- + +Nos complace anunciar la publicación de Ruby {{ release.version }}. + +{% assign release = site.data.releases | where: "version", "3.1.0-preview1" | first %} + + +## YJIT: Nuevo compilador experimental JIT en-proceso + +Ruby 3.1 incorpora YJIT, un nuevo compilador JIT en-proceso desarrollado +por Shopify. + +Desde que [Ruby 2.6 introdujo MJIT en 2018](https://www.ruby-lang.org/es/news/2018/12/25/ruby-2-6-0-released/), +su desempeño ha mejorado significativamente, y finalmente +[alcanzamos Ruby3x3 el año pasado](https://www.ruby-lang.org/es/news/2020/12/25/ruby-3-0-0-released/). +Pero aún cuando Optcarrot ha demostrado un impresionante aumento de velocidad, +el JIT no ha beneficiado aplicaciones de negocios del mundo real. + +Recientemente Shopify contribuyó muchas mejoras a Ruby para aumentar la +velocidad de su aplicación Rails. +YJIT es una contribución importante y busca mejorar el desempeño de +aplicaciones rails. + +Mientras MJIT es un compilador JIT basado-en-métodos y usa un +compilador de C externo, YJIT usa Versiones de Bloques Básicos e +incluye un compilador JIT. Con Versiones de Bloques Básicos Perezosa +(Lazy Basic Block Versioning - LBBV), que primero compilan el comienzo de +un método e incrementalmente compila el resto a medida que el tipo de +los argumentos y variables se determina dinámicamente. Ver una introducción +detallada en +[YJIT: a basic block versioning JIT compiler for CRuby](https://dl.acm.org/doi/10.1145/3486606.3486781). + +Con esta tecnología, YJIT alcanza tanto un tiempo de calentamiento rápido como +mejoras en desempeño en la mayoría de software del mundo-real, hasta +22% en railsbench, 39% en liquid-render. + + + +YJIT es aún una características experimental, y como tal, +está deshabilitado de manera predeterminada. Si quiere usarlo, +especifique la opción `--yjit` en la línea de ordenes que habilita +YJIT. Por ahora está limitado a macOS & Linux sobre plataformas +x86-64. + +* https://bugs.ruby-lang.org/issues/18229 +* https://shopify.engineering/yjit-just-in-time-compiler-cruby +* https://www.youtube.com/watch?v=PBVLf3yfMs8 + +## Gema debug: Un nuevo depurador + +Se incluye un nuevo depurador [debug.gem](https://github.com/ruby/debug). +debug.gem es una implementación de un depurador rápido que provee muchas +características tales como depuración remota, REPL con colores, integración +con IDE (VSCode) entre otras. +Remplaza la librería estándar `lib/debug.rb`. + +## error_highlight: Localización de errores afinada en las trazas + +Se ha incluido un gema con Ruby, error_highlight. Proporciona +localización afinada de errores en la traza: + +``` +$ ruby prueba.rb +prueba.rb:1:in `
': undefined method `time' for 1:Integer (NoMethodError) + +1.time {} + ^^^^^ +Did you mean? times +``` + +Esta gema está habilitada de manera predeterminada. Puede deshabilitarla +desde la línea de ordenes con la opción `--disable-error_highlight`. +Ver detalles en [el repositorio](https://github.com/ruby/error_highlight). + +## Mejoras a Irb + +Se describirán en la siguiente versión previa. + +## Otras características nuevas y notables + +### Lenguaje + +* Pueden omitirse valores en literales de diccionarios y en argumentos de + palabra reservada [Feature #14579] + * `{x:, y:}` es azúcar sintáctica para `{x: x, y: y}`. + * `foo(x:, y:)` es azúcar sintáctica para `foo(x: x, y: y)`. + +* En reconocimiento de patrones el operador pin ahora toma una + expresión [Feature #17411] + +```ruby +Prime.each_cons(2).lazy.find_all{_1 in [n, ^(n + 2)]}.take(3).to_a +#=> [[3, 5], [5, 7], [11, 13]] +``` + + +### RBS + +RBS es un lenguaje para describir la estructura de programas Ruby. +Ver detalles en [el repositorio](https://github.com/ruby/rbs). + +Actualizaciones desde Ruby 3.0.0: + +* se introduce `rbs collection` para administrar RBSs de gemas. + [doc](https://github.com/ruby/rbs/blob/master/docs/collection.md) +* Se han añadido/actualizado muchas características incorporadas y de + la librería estándar. +* Incluye soluciones a muchas fallas, así como mejoras de desempeño. + +Ver más informaciń en [el archivo CHANGELOG.md](https://github.com/ruby/rbs/blob/master/CHANGELOG.md). + +### TypeProf + +TypeProf es un analizador de tipos estático para Ruby. Genera un prototipo +en RBS a partir de código Ruby sin anotaciones de tipos. Ver detalles en +[el documento](https://github.com/ruby/typeprof/blob/master/doc/doc.md). + +Actualizaciones desde Ruby 3.0.0: + +* Se ha implementado [soporte experimental para IDE](https://github.com/ruby/typeprof/blob/master/doc/ide.md). +* Muchas correcciones a fallas y mejoras de desempeño. + +## Mejoras de desempeño + +* MJIT + * Para cargas de trabajo como Rails, se cambia `--jit-max-cache` de 100 + a 10000. + El compilador JIT ya no se salta la compilación de métodos con menos de + 1000 instrucciones. + * Para soportar Zeitwerk de Rails, el código compilado con JIT ya no + se cancela cuando se habilita un TracePoint para eventos de clase. + +## Otros cambios notables desde 3.0 + +* Reconocimiento de patrones en una línea, e.g., `ary => [x, y, z]`, ya no es + experimental. +* Se ha cambiado levemente el orden de evaluación de asignaciones múltiples. + [[Bug #4443]] + * `foo[0], bar[0] = baz, qux` era evaluado en el orden `baz`, `qux`, `foo`, + y después `bar` en Ruby 3.0. En Ruby 3.1, se evalúa en el orden + `foo`, `bar`, `baz`, y después `qux`. +* Localización de ancho variable: Cadenas (experimental) + [[Falla #18239]](https://bugs.ruby-lang.org/issues/18239) + +### Actualizaciones a la librería estándar + +* Se actualizaron algunas librerías estándar + * RubyGems + * Bundler + * RDoc 6.4.0 + * ReLine + * JSON 2.6.0 + * Psych 4.0.2 + * FileUtils 1.6.0 + * Fiddle + * StringIO 3.0.1 + * IO::Console 0.5.9 + * IO::Wait 0.2.0 + * CSV + * Etc 1.3.0 + * Date 3.2.0 + * Zlib 2.1.1 + * StringScanner + * IpAddr + * Logger 1.4.4 + * OStruct 0.5.0 + * Irb + * Racc 1.6.0 + * Delegate 0.2.0 + * Benchmark 0.2.0 + * CGI 0.3.0 + * Readline(C-ext) 0.1.3 + * Timeout 0.2.0 + * YAML 0.2.0 + * URI 0.11.0 + * OpenSSL + * DidYouMean + * Weakref 0.1.1 + * Tempfile 0.1.2 + * TmpDir 0.1.2 + * English 0.7.1 + * Net::Protocol 0.1.2 + * Net::Http 0.2.0 + * BigDecimal + * OptionParser 0.2.0 + * Set + * Find 0.1.1 + * Rinda 0.1.1 + * Erb + * NKF 0.1.1 + * Base64 0.1.1 + * OpenUri 0.2.0 + * SecureRandom 0.1.1 + * Resolv 0.2.1 + * Resolv::Replace 0.1.0 + * Time 0.2.0 + * PP 0.2.1 + * Prettyprint 0.1.1 + * Drb 2.1.0 + * Pathname 0.2.0 + * Digest 3.1.0.pre2 + * Un 0.2.0 +* Se actualizaron las siguientes gemas incluidas en Ruby + * minitest 5.14.4 + * power_assert 2.0.1 + * rake 13.0.6 + * test-unit 3.5.0 + * rbs 1.6.2 + * typeprof 0.20.0 +* Las siguientes gemas por omisión ahora son ahora gemas incluidas en Ruby. + * net-ftp + * net-imap + * net-pop + * net-smtp + * matrix + * prime + +Ver más detalles en +[NEWS](https://github.com/ruby/ruby/blob/{{ release.tag }}/NEWS.md) +o [en la bitácora de cambios](https://github.com/ruby/ruby/compare/v3_0_0...{{ release.tag }}). + +Con esos cambios, [{{ release.stats.files_changed }} archivos cambiados, {{ release.stats.insertions }} inserciones(+), {{ release.stats.deletions }} eliminaciones (-)](https://github.com/ruby/ruby/compare/v3_0_0...{{ release.tag }}#file_bucket) +desde Ruby 3.0.0! + +## Descargas + +* <{{ release.url.gz }}> + + SIZE: {{ release.size.gz }} + SHA1: {{ release.sha1.gz }} + SHA256: {{ release.sha256.gz }} + SHA512: {{ release.sha512.gz }} + +* <{{ release.url.xz }}> + + SIZE: {{ release.size.xz }} + SHA1: {{ release.sha1.xz }} + SHA256: {{ release.sha256.xz }} + SHA512: {{ release.sha512.xz }} + +* <{{ release.url.zip }}> + + SIZE: {{ release.size.zip }} + SHA1: {{ release.sha1.zip }} + SHA256: {{ release.sha256.zip }} + SHA512: {{ release.sha512.zip }} + +## Qué es Ruby + +Ruby fue desarrollado inicialmente pof Matz (Yukihiro Matsumoto) en 1993, +y ahora es desarrollado como Código Abierto. Corre en múltiples +plataformas y se usa en todo el mundo especialmente para desarrollo web. From 8582d2af9bc328a6d90d11b44daaf48e169f18ed Mon Sep 17 00:00:00 2001 From: jinroq <2787780+jinroq@users.noreply.github.com> Date: Fri, 26 Nov 2021 14:40:51 +0900 Subject: [PATCH 0094/1090] Japanese translation of "CVE-2021-31810: Trusting FTP PASV responses vulnerability in Net::FTP" Translate [https://github.com/ruby/www.ruby-lang.org/blob/master/en/news/_posts/2021-07-07-starttls-stripping-in-net-imap.md](https://github.com/ruby/www.ruby-lang.org/blob/master/en/news/_posts/2021-07-07-starttls-stripping-in-net-imap.md) to ja. --- ...7-07-trusting-pasv-responses-in-net-ftp.md | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 ja/news/_posts/2021-07-07-trusting-pasv-responses-in-net-ftp.md diff --git a/ja/news/_posts/2021-07-07-trusting-pasv-responses-in-net-ftp.md b/ja/news/_posts/2021-07-07-trusting-pasv-responses-in-net-ftp.md new file mode 100644 index 0000000000..6e122de845 --- /dev/null +++ b/ja/news/_posts/2021-07-07-trusting-pasv-responses-in-net-ftp.md @@ -0,0 +1,35 @@ +--- +layout: news_post +title: "CVE-2021-31810: Net::FTP における信頼性のある FTP PASV 応答の脆弱性について" +author: "shugo" +translator: "jinroq" +date: 2021-07-07 09:00:00 +0000 +tags: security +lang: ja +--- + +信頼性のある FTP PASV 応答の脆弱性が Net::FTP で発見されました。 +この脆弱性は [CVE-2021-31810](https://nvd.nist.gov/vuln/detail/CVE-2021-31810) として登録されています。 +Ruby をアップグレードすることを強く推奨します。 + +net-ftp は Ruby 3.0.1 の デフォルト gem ですが、パッケージ化の問題があるため、Ruby 自体をアップグレードしてください。 + +## 詳細 + +悪意のある FTP サーバーが、PASV 応答を利用して Net::FTP を偽装し、特定の IP アドレスとポートに接続し直す可能性があります。 +これにより Net::FTP は本来では抽出できない非公開なサービスに関する情報を抽出する可能性があります +(例: 攻撃者はポートスキャンやサービスバナーの抽出を実行できます)。 + +## 影響を受けるバージョン + +* Ruby 2.6 系列: 2.6.7 およびそれ以前のバージョン +* Ruby 2.7 系列: 2.7.3 およびそれ以前のバージョン +* Ruby 3.0 系列: 3.0.1 およびそれ以前のバージョン + +## クレジット + +この脆弱性情報は、[Alexandr Savca](https://hackerone.com/chinarulezzz) 氏によって報告されました。 + +## 更新履歴 + +* 2021-07-07 18:00:00 (JST) 初版 From 85b21c3e53f54cef7d0b7f8f156c0f708c950bb4 Mon Sep 17 00:00:00 2001 From: jinroq <2787780+jinroq@users.noreply.github.com> Date: Thu, 25 Nov 2021 17:52:06 +0900 Subject: [PATCH 0095/1090] Japanese translation of "CVE-2021-41816: Buffer Overrun in CGI.escape_html" Translate [https://github.com/ruby/www.ruby-lang.org/blob/master/en/news/_posts/2021-11-24-buffer-overrun-in-cgi-escape_html-cve-2021-41816.md](https://github.com/ruby/www.ruby-lang.org/blob/master/en/news/_posts/2021-11-24-buffer-overrun-in-cgi-escape_html-cve-2021-41816.md) to ja. --- ...errun-in-cgi-escape_html-cve-2021-41816.md | 39 +++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 ja/news/_posts/2021-11-24-buffer-overrun-in-cgi-escape_html-cve-2021-41816.md diff --git a/ja/news/_posts/2021-11-24-buffer-overrun-in-cgi-escape_html-cve-2021-41816.md b/ja/news/_posts/2021-11-24-buffer-overrun-in-cgi-escape_html-cve-2021-41816.md new file mode 100644 index 0000000000..b6712c7c3f --- /dev/null +++ b/ja/news/_posts/2021-11-24-buffer-overrun-in-cgi-escape_html-cve-2021-41816.md @@ -0,0 +1,39 @@ +--- +layout: news_post +title: "CVE-2021-41816: CGI.escape_html 内のバッファオーバーラン" +author: "mame" +translator: "jinroq" +date: 2021-11-24 12:00:00 +0000 +tags: security +lang: ja +--- + +A buffer overrun vulnerability was discovered in CGI.escape_html. +This vulnerability has been assigned the CVE identifier [CVE-2021-41816](https://nvd.nist.gov/vuln/detail/CVE-2021-41816). +We strongly recommend upgrading Ruby. +CGI.escape_html 内のバッファオーバーランの脆弱性が発見されました。 +この脆弱性は、[CVE-2021-41816](https://nvd.nist.gov/vuln/detail/CVE-2021-41816)として登録されています。 +Ruby をアップグレードすることを強く推奨します。 + +## 詳細 + +`long` 型が 4 バイトかかるプラットフォーム(典型的なものは Windows)で非常に大きな文字列(700 MB 以上)を `CGI.escape_html` に渡すと、バッファオーバーフローを引き起こす脆弱性があります。 + +cgi gem をバージョン 0.3.1, 0.2.1, 0.1.1 もしくはこれら以上のバージョンに更新してください。`gem update cgi` を使用して更新できます。bundler を使用している場合は、 `Gemfile` に `gem "cgi", "> = 0.3.1"` を追加してください。 +または、Rubyを 2.7.5 または 3.0.3 に更新してください。 + +この問題は Ruby 2.7 以降で発見されたので、Ruby 2.6 でバンドルされている cgi バージョンには脆弱性はありません。 + +## 影響を受けるバージョン + +* cgi gem 0.1.0 以前(Ruby 2.7.5 より前にバンドルされている Ruby 2.7 系列) +* cgi gem 0.2.0 以前(Ruby 3.0.3 より前にバンドルされている Ruby 3.0 系列) +* cgi gem 0.3.0 以前 + +## クレジット + +この脆弱性情報は、[chamal](https://hackerone.com/chamal) 氏によって報告されました。 + +## 更新履歴 + +* 2021-11-24 21:00:00 (JST) 初版 From cf989664e27d38c7ed1c38c6548d8a32523721e3 Mon Sep 17 00:00:00 2001 From: jinroq <2787780+jinroq@users.noreply.github.com> Date: Fri, 26 Nov 2021 12:46:24 +0900 Subject: [PATCH 0096/1090] Japanese translation of "Ruby 3.1.0 Preview 1 Released" Translate [https://github.com/ruby/www.ruby-lang.org/blob/master/en/news/_posts/2021-11-09-ruby-3-1-0-preview1-released.md](https://github.com/ruby/www.ruby-lang.org/blob/master/en/news/_posts/2021-11-09-ruby-3-1-0-preview1-released.md) to ja. --- ...2021-11-09-ruby-3-1-0-preview1-released.md | 210 ++++++++++++++++++ 1 file changed, 210 insertions(+) create mode 100644 ja/news/_posts/2021-11-09-ruby-3-1-0-preview1-released.md diff --git a/ja/news/_posts/2021-11-09-ruby-3-1-0-preview1-released.md b/ja/news/_posts/2021-11-09-ruby-3-1-0-preview1-released.md new file mode 100644 index 0000000000..bcd1ca2733 --- /dev/null +++ b/ja/news/_posts/2021-11-09-ruby-3-1-0-preview1-released.md @@ -0,0 +1,210 @@ +--- +layout: news_post +title: "Ruby 3.1.0 Preview 1 リリース" +author: "naruse" +translator: "jinroq" +date: 2021-11-09 00:00:00 +0000 +lang: ja +--- + +Ruby 3.1 に向けてフィードバックを得るためのリリースである、Ruby 3.1.0-preview1 が公開されました。 + +{% assign release = site.data.releases | where: "version", "3.1.0-preview1" | first %} + +## YJIT: 新しいインプロセス JIT コンパイラ (experimental) + +Ruby 3.1 には、Shopify 社が開発した新しいインプロセス JIT コンパイラである YJIT をマージしています。 + +[2018 年に Ruby 2.6 が MJIT を導入](https://www.ruby-lang.org/en/news/2018/12/25/ruby-2-6-0-released/)して以降、パフォーマンスは大幅に向上し、ついに[昨年 Ruby3x3 を達成しました](https://www.ruby-lang.org/en/news/2020/12/25/ruby-3-0-0-released/)。しかし、この JIT は Optcarrot では目覚ましい速度改善を示したものの、実世界のプロダクトで運用するには厳しいものでした。 + +近年 Shopify 社は Rails アプリケーションを高速化するために Ruby へ多くの改善をしてくれました。その中でも YJIT は重要な貢献であり、また、Rails アプリケーションのパフォーマンス向上を目的としています。 + +MJIT はメソッドベースの JIT コンパイラであり、外部 C コンパイラを使用します。一方、YJIT は Basic Block Versioning を使用し、その中に JIT コンパイラを含みます。 Lazy Basic Block Versioning(LBBV)では、最初にメソッドの先頭をコンパイルし、引数と変数の型が動的に決定されると、残りをインクリメンタルにコンパイルします。詳細な概要については [YJIT: a basic block versioning JIT compiler for CRuby](https://dl.acm.org/doi/10.1145/3486606.3486781) を参照してください。 + +この技術により、YJIT は実世界の多くのプロダクトで高速な起動時間とパフォーマンス向上の両方を実現しています。railsbench 上で 22%、liquid-render 上で 39% の改善を実現しています。 + + + +YJIT はまだ実験的な機能であるため、デフォルトでは無効になっています。使用するにはコマンドラインオプション `--yjit` を指定して YJIT を有効にします。また YJIT が仕様できる環境は、現時点では x86-64 プラットフォーム搭載の macOS および Linux に限定されています。 + +* [https://bugs.ruby-lang.org/issues/18229](https://bugs.ruby-lang.org/issues/18229) +* [https://shopify.engineering/yjit-just-in-time-compiler-cruby](https://shopify.engineering/yjit-just-in-time-compiler-cruby) +* [https://www.youtube.com/watch?v=PBVLf3yfMs8](https://www.youtube.com/watch?v=PBVLf3yfMs8) + +## debug gem: 新しいデバッガ + +新しいデバッガ [debug.gem](https://github.com/ruby/debug) がバンドルされています。 debug.gem は高速なデバッガであり、リモートデバッグ、色付き REPL、IDE integration(VSCode)など多くの機能を提供します。これは標準添付ライブラリの `lib/debug.rb` に置き換えられます。 + +## error_highlight: バックトレース内でさらに詳細なエラー箇所を示す機能 + +組み込み gem である error_highlight が導入されました。バックトレース内でさらに詳細なエラー箇所を示すことができます: + +``` +$ ruby test.rb +test.rb:1:in `
': undefined method `time' for 1:Integer (NoMethodError) + +1.time {} + ^^^^^ +Did you mean? times +``` + +この gem はデフォルトで有効になっています。コマンドラインオプション `--disable-error_highlight` を使用して無効にできます。詳細は[リポジトリ](https://github.com/ruby/error_highlight)を参照してください。 + +## Irb の改善 + +次の preview 版で説明します。 + +## その他の主要な新機能 + +### 言語仕様 + +* ハッシュリテラルとキーワード引数の値は省略できます [Feature #14579] + * `{x:, y:}` は `{x: x, y: y}` の糖衣構文です + * `foo(x:, y:)` は `foo(x: x, y: y)` の糖衣構文です + +* パターンマッチングのピン演算子が式を受け取るようになりました [Feature #17411] + +```ruby +Prime.each_cons(2).lazy.find_all{_1 in [n, ^(n + 2)]}.take(3).to_a +#=> [[3, 5], [5, 7], [11, 13]] +``` + +### RBS + +RBS は Ruby プログラムの構造を記述するための言語です。詳細は[リポジトリ](https://github.com/ruby/rbs)を参照してください。 + +Ruby 3.0.0 からの変更点: + +* gem の RBS を管理する `rbs collection` が導入されています [[doc]](https://github.com/ruby/rbs/blob/master/docs/collection.md) +* 組み込みライブラリおよび標準添付ライブラリの多くのシグネチャが追加/更新されています +* 多くのバグ修正とパフォーマンスの改善も含まれています + +詳細は [CHANGELOG.md](https://github.com/ruby/rbs/blob/master/CHANGELOG.md) を参照してください。 + +### TypeProf + +TypeProf は Ruby の静的型解析器です。型注釈のない Ruby コードから RBS のプロトタイプを生成します。詳細は[ドキュメント](https://github.com/ruby/typeprof/blob/master/doc/doc.md)を参照してください。 + +Ruby 3.0.0 からの変更点: + +* [IDE サポート](https://github.com/ruby/typeprof/blob/master/doc/ide.md)が実装されました (Experimental) +* 多くのバグ修正とパフォーマンスの改善も含まれています + +## パフォーマンスの改善 + +* MJIT + * Rails のようなワークロードのために、`--jit-max-cache` のデフォルト値を 100 から 10000 に変更しています。 + JIT コンパイラは 1000 命令列長より長いメソッドのコンパイルをスキップしなくなりました + * Rails の Zeitwerk モードをサポートするために、クラスイベントで TracePoint が有効になっている場合に JIT コンパイルされたコードをキャンセルしなくなりました + +## その他の注目すべき 3.0 からの変更点 + +* 1 行パターンマッチ(例: `ary => [x, y, z]`)が experimental ではなくなりました +* 多重代入の評価順序が若干変更されました [[Bug #4443]](https://bugs.ruby-lang.org/issues/4443) + * Ruby 3.0では `foo[0], bar[0] = baz, qux` は `baz`, `qux`,`foo`, `bar` の順に評価されていました。Ruby 3.1 からは `foo`,`bar`, `baz`,`qux` の順に評価されるようになります +* 文字列の可変幅割り当て (experimental) [[Bug #18239]](https://bugs.ruby-lang.org/issues/18239) + +### 標準添付ライブラリの更新 + +* いくつかの標準添付ライブラリが更新されています + * RubyGems + * Bundler + * RDoc 6.4.0 + * ReLine + * JSON 2.6.0 + * Psych 4.0.2 + * FileUtils 1.6.0 + * Fiddle + * StringIO 3.0.1 + * IO::Console 0.5.9 + * IO::Wait 0.2.0 + * CSV + * Etc 1.3.0 + * Date 3.2.0 + * Zlib 2.1.1 + * StringScanner + * IpAddr + * Logger 1.4.4 + * OStruct 0.5.0 + * Irb + * Racc 1.6.0 + * Delegate 0.2.0 + * Benchmark 0.2.0 + * CGI 0.3.0 + * Readline(C-ext) 0.1.3 + * Timeout 0.2.0 + * YAML 0.2.0 + * URI 0.11.0 + * OpenSSL + * DidYouMean + * Weakref 0.1.1 + * Tempfile 0.1.2 + * TmpDir 0.1.2 + * English 0.7.1 + * Net::Protocol 0.1.2 + * Net::Http 0.2.0 + * BigDecimal + * OptionParser 0.2.0 + * Set + * Find 0.1.1 + * Rinda 0.1.1 + * Erb + * NKF 0.1.1 + * Base64 0.1.1 + * OpenUri 0.2.0 + * SecureRandom 0.1.1 + * Resolv 0.2.1 + * Resolv::Replace 0.1.0 + * Time 0.2.0 + * PP 0.2.1 + * Prettyprint 0.1.1 + * Drb 2.1.0 + * Pathname 0.2.0 + * Digest 3.1.0.pre2 + * Un 0.2.0 +* 以下のバンドルされた gems が更新されています + * minitest 5.14.4 + * power_assert 2.0.1 + * rake 13.0.6 + * test-unit 3.5.0 + * rbs 1.6.2 + * typeprof 0.20.0 +* 以下のデフォルト gems がバンドルされた gem になりました + * net-ftp + * net-imap + * net-pop + * net-smtp + * matrix + * prime + +詳細は [NEWS](https://github.com/ruby/ruby/blob/{{ release.tag }}/NEWS.md) か [commit logs](https://github.com/ruby/ruby/compare/v3_0_0...{{ release.tag }}) を参照してください。 + +なお、こうした変更により、Ruby 3.0.0 以降では [{{ release.stats.files_changed }} 個のファイルに変更が加えられ、 {{ release.stats.insertions }} 行の追加と {{ release.stats.deletions }} 行の削除が行われました](https://github.com/ruby/ruby/compare/v3_0_0...{{ release.tag }}#file_bucket)! + +## ダウンロード + +* <{{ release.url.gz }}> + + SIZE: {{ release.size.gz }} + SHA1: {{ release.sha1.gz }} + SHA256: {{ release.sha256.gz }} + SHA512: {{ release.sha512.gz }} + +* <{{ release.url.xz }}> + + SIZE: {{ release.size.xz }} + SHA1: {{ release.sha1.xz }} + SHA256: {{ release.sha256.xz }} + SHA512: {{ release.sha512.xz }} + +* <{{ release.url.zip }}> + + SIZE: {{ release.size.zip }} + SHA1: {{ release.sha1.zip }} + SHA256: {{ release.sha256.zip }} + SHA512: {{ release.sha512.zip }} + +## Ruby とは + +Ruby はまつもとゆきひろ(Matz)によって 1993 年に開発が始められ、今もオープンソースソフトウェアとして開発が続けられています。 +Ruby は様々なプラットフォームで動き、世界中で、特に Web アプリケーション開発のために使われています。 From cd5d083f793f69db198d73e21f07cc910bcd9d4a Mon Sep 17 00:00:00 2001 From: jinroq <2787780+jinroq@users.noreply.github.com> Date: Fri, 26 Nov 2021 21:26:16 +0900 Subject: [PATCH 0097/1090] Fixed a bug Fixed a bug that disturbed `release.version` from being displayed. --- ja/news/_posts/2021-11-09-ruby-3-1-0-preview1-released.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ja/news/_posts/2021-11-09-ruby-3-1-0-preview1-released.md b/ja/news/_posts/2021-11-09-ruby-3-1-0-preview1-released.md index bcd1ca2733..125aed23f2 100644 --- a/ja/news/_posts/2021-11-09-ruby-3-1-0-preview1-released.md +++ b/ja/news/_posts/2021-11-09-ruby-3-1-0-preview1-released.md @@ -7,10 +7,10 @@ date: 2021-11-09 00:00:00 +0000 lang: ja --- -Ruby 3.1 に向けてフィードバックを得るためのリリースである、Ruby 3.1.0-preview1 が公開されました。 - {% assign release = site.data.releases | where: "version", "3.1.0-preview1" | first %} +Ruby 3.1 に向けてフィードバックを得るためのリリースである、Ruby {{ release.version }} が公開されました。 + ## YJIT: 新しいインプロセス JIT コンパイラ (experimental) Ruby 3.1 には、Shopify 社が開発した新しいインプロセス JIT コンパイラである YJIT をマージしています。 From 36bbdaa59d6a658c4bdcf51ab8575e0da8b070fe Mon Sep 17 00:00:00 2001 From: jinroq <2787780+jinroq@users.noreply.github.com> Date: Fri, 3 Dec 2021 17:06:26 +0900 Subject: [PATCH 0098/1090] Removed unnecessary English text. --- ...1-11-24-buffer-overrun-in-cgi-escape_html-cve-2021-41816.md | 3 --- 1 file changed, 3 deletions(-) diff --git a/ja/news/_posts/2021-11-24-buffer-overrun-in-cgi-escape_html-cve-2021-41816.md b/ja/news/_posts/2021-11-24-buffer-overrun-in-cgi-escape_html-cve-2021-41816.md index b6712c7c3f..6414233097 100644 --- a/ja/news/_posts/2021-11-24-buffer-overrun-in-cgi-escape_html-cve-2021-41816.md +++ b/ja/news/_posts/2021-11-24-buffer-overrun-in-cgi-escape_html-cve-2021-41816.md @@ -8,9 +8,6 @@ tags: security lang: ja --- -A buffer overrun vulnerability was discovered in CGI.escape_html. -This vulnerability has been assigned the CVE identifier [CVE-2021-41816](https://nvd.nist.gov/vuln/detail/CVE-2021-41816). -We strongly recommend upgrading Ruby. CGI.escape_html 内のバッファオーバーランの脆弱性が発見されました。 この脆弱性は、[CVE-2021-41816](https://nvd.nist.gov/vuln/detail/CVE-2021-41816)として登録されています。 Ruby をアップグレードすることを強く推奨します。 From b9a2cab013eaeac40e2295b92485b2a7b6b0d350 Mon Sep 17 00:00:00 2001 From: jinroq <2787780+jinroq@users.noreply.github.com> Date: Fri, 26 Nov 2021 15:21:54 +0900 Subject: [PATCH 0099/1090] Translate "CVE-2021-32066: A StartTLS stripping vulnerability in Net::IMAP" (ja) Translate [https://github.com/ruby/www.ruby-lang.org/blob/master/en/news/_posts/2021-07-07-starttls-stripping-in-net-imap.md](https://github.com/ruby/www.ruby-lang.org/blob/master/en/news/_posts/2021-07-07-starttls-stripping-in-net-imap.md) to ja. --- ...21-07-07-starttls-stripping-in-net-imap.md | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 ja/news/_posts/2021-07-07-starttls-stripping-in-net-imap.md diff --git a/ja/news/_posts/2021-07-07-starttls-stripping-in-net-imap.md b/ja/news/_posts/2021-07-07-starttls-stripping-in-net-imap.md new file mode 100644 index 0000000000..6d2f0d0343 --- /dev/null +++ b/ja/news/_posts/2021-07-07-starttls-stripping-in-net-imap.md @@ -0,0 +1,34 @@ +--- +layout: news_post +title: "CVE-2021-32066: Net::IMAP 内の StartTLS ストリッピングの脆弱性について" +author: "shugo" +translator: "jinroq" +date: 2021-07-07 09:00:00 +0000 +tags: security +lang: ja +--- + +Net::IMAP 内の StartTLS ストリッピングに脆弱性が発見されました。 +この脆弱性は [CVE-2021-32066](https://nvd.nist.gov/vuln/detail/CVE-2021-32066) として登録されています。 +Ruby をアップグレードすることを強く推奨します。 + +net-imap は Ruby 3.0.1 の デフォルト gem ですが、パッケージ化の問題があるため、Ruby 自体をアップグレードしてください。 + +## 詳細 + +Net::IMAP は、StartTLS が不明な応答で失敗した場合に例外を発生させません。これにより、中間者攻撃者がクライアントとレジストリ間のネットワークの場所を利用して StartTLS コマンドをブロックできる可能性があります。つまり、中間者攻撃者が TLS 保護をバイパスできる可能性があります。 +これは「StartTLS ストリッピング攻撃」とも呼ばれています。 + +## 影響を受けるバージョン + +* Ruby 2.6 系列: 2.6.7 およびそれ以前のバージョン +* Ruby 2.7 系列: 2.7.3 およびそれ以前のバージョン +* Ruby 3.0 系列: 3.0.1 およびそれ以前のバージョン + +## クレジット + +この脆弱性情報は、[Alexandr Savca](https://hackerone.com/chinarulezzz) 氏によって報告されました。 + +## 更新履歴 + +* 2021-07-07 18:00:00 (JST) 初版 From 0e5e25f8e1e46d121cc14b0936a835696d9db50f Mon Sep 17 00:00:00 2001 From: jinroq <2787780+jinroq@users.noreply.github.com> Date: Fri, 26 Nov 2021 16:04:13 +0900 Subject: [PATCH 0100/1090] Translate "CVE-2021-28965: XML round-trip vulnerability in REXML" (ja) Translate [https://github.com/ruby/www.ruby-lang.org/blob/master/en/news/_posts/2021-04-05-xml-round-trip-vulnerability-in-rexml-cve-2021-28965.md](https://github.com/ruby/www.ruby-lang.org/blob/master/en/news/_posts/2021-04-05-xml-round-trip-vulnerability-in-rexml-cve-2021-28965.md) to ja. --- ...p-vulnerability-in-rexml-cve-2021-28965.md | 47 +++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 ja/news/_posts/2021-04-05-xml-round-trip-vulnerability-in-rexml-cve-2021-28965.md diff --git a/ja/news/_posts/2021-04-05-xml-round-trip-vulnerability-in-rexml-cve-2021-28965.md b/ja/news/_posts/2021-04-05-xml-round-trip-vulnerability-in-rexml-cve-2021-28965.md new file mode 100644 index 0000000000..65589d9ebe --- /dev/null +++ b/ja/news/_posts/2021-04-05-xml-round-trip-vulnerability-in-rexml-cve-2021-28965.md @@ -0,0 +1,47 @@ +--- +layout: news_post +title: "CVE-2021-28965: REXML 内の XML ラウンドトリップの脆弱性について" +author: "mame" +translator: "jinroq" +date: 2021-04-05 12:00:00 +0000 +tags: security +lang: ja +--- + +Ruby にバンドルされている REXML gem 内の XML ラウンドトリップに脆弱性が発見されました。 +この脆弱性は [CVE-2021-28965](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-28965) として登録されています。 +REXML gem をアップグレードすることを強く推奨します。 + +## 詳細 + +加工された XML ドキュメントをパーシングおよびシリアル化する場合、REXML gem(Ruby にバンドルされているものを含む)は、元のドキュメントとは構造が異なる誤った XML ドキュメントを生成する可能性があります。 +この問題の影響はコンテキストによって大きく異なりますが、REXML を使用している一部のプログラムでは脆弱性が生じる可能性があります。 + +REXML gem をバージョン 3.2.5 以降に更新してください。 + +Ruby 2.6 以降を使用している場合: + +* Ruby 2.6.7、2.7.3、もしくは 3.0.1 を使ってください +* または `gem update rexml` で更新することもできます。bundler を使用している場合は、`Gemfile` に `gem "rexml", ">= 3.2.5"` を追加してください + +Ruby 2.5.8 以前を使用している場合: + +* Ruby 2.5.9 を使ってください +* Ruby 2.5.8 以前では `gem update rexml` を実行できません +* Ruby 2.5 系列は現在 EOL であるため、Ruby を 2.6.7 以降に可能な限り早く更新することを検討してください + +## 影響を受けるバージョン + +* Ruby​​ 2.5.8 以前(このバージョンでは `gem update rexml` を実行できません。) +* Ruby​​ 2.6.6 以前 +* Ruby​​ 2.7.2 以前 +* Ruby​​ 3.0.0 +* REXML gem 3.2.4 以前 + +## クレジット + +この脆弱性情報は [Juho Nurminen](https://hackerone.com/jupenur) 氏によって報告されました。 + +## 更新履歴 + +* 2021-04-05 21:00:00 (JST) 初版 From 70f0285ff7ba3b5708f431ef92dab669f939d023 Mon Sep 17 00:00:00 2001 From: jinroq <2787780+jinroq@users.noreply.github.com> Date: Fri, 26 Nov 2021 16:52:26 +0900 Subject: [PATCH 0101/1090] Translate "CVE-2021-28966: Path traversal in Tempfile on Windows" (ja) Translate [https://github.com/ruby/www.ruby-lang.org/blob/master/en/news/_posts/2021-04-05-tempfile-path-traversal-on-windows-cve-2021-28966.md](https://github.com/ruby/www.ruby-lang.org/blob/master/en/news/_posts/2021-04-05-tempfile-path-traversal-on-windows-cve-2021-28966.md) to ja. --- ...ath-traversal-on-windows-cve-2021-28966.md | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 ja/news/_posts/2021-04-05-tempfile-path-traversal-on-windows-cve-2021-28966.md diff --git a/ja/news/_posts/2021-04-05-tempfile-path-traversal-on-windows-cve-2021-28966.md b/ja/news/_posts/2021-04-05-tempfile-path-traversal-on-windows-cve-2021-28966.md new file mode 100644 index 0000000000..95321df7ee --- /dev/null +++ b/ja/news/_posts/2021-04-05-tempfile-path-traversal-on-windows-cve-2021-28966.md @@ -0,0 +1,36 @@ +--- +layout: news_post +title: "CVE-2021-28966: Windows 版 Tempfile 内のパストラバーサルについて" +author: "mame" +translator: "jinroq" +date: 2021-04-05 12:00:00 +0000 +tags: security +lang: ja +--- + +Windows 版 Ruby にバンドルされている tmpdir ライブラリには、意図しないディレクトリを作成してしまう脆弱性が発見されました。 +また、Windows 版 Ruby にバンドルされている tempfile ライブラリは、内部で tmpdir を使用しているため同様の脆弱性があります。 +この脆弱性は [CVE-2021-28966](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-28966) として登録されています。 + +## 詳細 + +tmpdir ライブラリで導入された `Dir.mktmpdir` メソッドは、第一引数に作成するディレクトリ名のプレフィックスとサフィックスを受け取ることができます。 +プレフィックスには相対ディレクトリ指定子 `"..\\"` を含めることができるため、このメソッドは任意のディレクトリを対象にすることができます。 +したがって、スクリプトが外部入力をプレフィックスとして受け取り、対象のディレクトリに不適切なアクセス許可がある、もしくは、ruby プロセスに不適切な権限がある場合に、攻撃者は任意のディレクトリに対してディレクトリやファイルを作成することができます。 + +同じ脆弱性が [CVE-2018-6914](https://www.ruby-lang.org/en/news/2018/03/28/unintentional-file-and-directory-creation-with-directory-traversal-cve-2018-6914/) として登録されていますが、Windows 版の対応が不十分でした。 + +影響を受けるバージョンの Ruby を利用している全ユーザーは、すぐにアップグレードする必要があります。 + +## 影響を受けるバージョン + +* Ruby 2.7.2 以前 +* Ruby 3.0.0 + +## クレジット + +この脆弱性情報は [Bugdiscloseguys](https://hackerone.com/bugdiscloseguys) 氏によって報告されました。 + +## 更新履歴 + +* 2021-04-05 21:00:00 (JST) 初版 From a6169206b4d5b1cad122b3225396e07ccc1ce542 Mon Sep 17 00:00:00 2001 From: jinroq <2787780+jinroq@users.noreply.github.com> Date: Fri, 26 Nov 2021 18:23:23 +0900 Subject: [PATCH 0102/1090] Translate "CVE-2020-25613: Potential HTTP Request Smuggling Vulnerability in WEBrick" (ja) Translate [https://github.com/ruby/www.ruby-lang.org/blob/master/en/news/_posts/2020-09-29-http-request-smuggling-cve-2020-25613.md](https://github.com/ruby/www.ruby-lang.org/blob/master/en/news/_posts/2020-09-29-http-request-smuggling-cve-2020-25613.md) to ja. --- ...9-http-request-smuggling-cve-2020-25613.md | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 ja/news/_posts/2020-09-29-http-request-smuggling-cve-2020-25613.md diff --git a/ja/news/_posts/2020-09-29-http-request-smuggling-cve-2020-25613.md b/ja/news/_posts/2020-09-29-http-request-smuggling-cve-2020-25613.md new file mode 100644 index 0000000000..bc0fdc11fe --- /dev/null +++ b/ja/news/_posts/2020-09-29-http-request-smuggling-cve-2020-25613.md @@ -0,0 +1,38 @@ +--- +layout: news_post +title: "CVE-2020-25613: WEBrick 内の潜在的な HTTP リクエストスマグリングの脆弱性について " +author: "mame" +translator: "jinroq" +date: 2020-09-29 06:30:00 +0000 +tags: security +lang: ja +--- + +WEBrick 内で潜在的な HTTP リクエストスマグリングの脆弱性が発見されました。 +この脆弱性は [CVE-2020-25613](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2020-25613) として登録されています。 +webrick gem をアップグレードすることを強く推奨します。 + +## 詳細 + +WEBrick は、無効な Transfer-Encoding ヘッダーに対して寛容すぎました。 +これは WEBrick と一部の HTTP プロキシサーバー間で一貫性のない解釈が発生し、攻撃者が HTTP リクエストを”スマグリング(smuggle)”する可能性があります。 +詳細は [CWE-444](https://cwe.mitre.org/data/definitions/444.html) を参照してください。 + +webric gem を 1.6.1 以降に更新してください。 +`gem update webrick` を実行すれば更新できます。 +bundler を使用している場合は、`Gemfile` に `gem "webrick", ">= 1.6.1"` を追加してください。 + +## 影響を受けるバージョン + +* webrick gem 1.6.0 以前 +* Ruby 2.7.1 以前のバージョンでバンドルされた webrick +* Ruby 2.6.6 以前のバージョンでバンドルされた webrick +* Ruby 2.5.8 以前のバージョンでバンドルされた webrick + +## クレジット + +この脆弱性情報は [piao](https://hackerone.com/piao) 氏によって報告されました。 + +## 更新履歴 + +* 2020-09-29 15:30:00 (JST) 初版 From 0771b94d4a43f2caf6afe0d6b2d6cd8632afb1b4 Mon Sep 17 00:00:00 2001 From: jinroq <2787780+jinroq@users.noreply.github.com> Date: Sat, 27 Nov 2021 18:50:14 +0900 Subject: [PATCH 0103/1090] Translate "Dispute of Vulnerability CVE-2014-2734" (ja) Translate [https://github.com/ruby/www.ruby-lang.org/blob/master/en/news/_posts/2014-05-09-dispute-of-vulnerability-cve-2014-2734.md](https://github.com/ruby/www.ruby-lang.org/blob/master/en/news/_posts/2014-05-09-dispute-of-vulnerability-cve-2014-2734.md) to ja. --- ...-dispute-of-vulnerability-cve-2014-2734.md | 75 +++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 ja/news/_posts/2014-05-09-dispute-of-vulnerability-cve-2014-2734.md diff --git a/ja/news/_posts/2014-05-09-dispute-of-vulnerability-cve-2014-2734.md b/ja/news/_posts/2014-05-09-dispute-of-vulnerability-cve-2014-2734.md new file mode 100644 index 0000000000..4fab485093 --- /dev/null +++ b/ja/news/_posts/2014-05-09-dispute-of-vulnerability-cve-2014-2734.md @@ -0,0 +1,75 @@ +--- +layout: news_post +title: "脆弱性 CVE-2014-2734 の争点について" +author: "emboss" +translator: "jinroq" +date: 2014-05-09 05:33:54 +0000 +tags: security +lang: ja +--- + +[CVE-2014-2734](http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2014-2734) として登録されている脆弱性について、「Ruby でも起こりうるのではないか」という報告を受けました。 +結論から書くと、以下に記載する詳細な分析の結果、Ruby に脆弱性があるとは**考えていません**。 + +この脆弱性により、攻撃者は証明書の署名を変更して任意のルート証明書を偽造し、証明書のオリジナルの秘密鍵を攻撃者が選択した秘密鍵に都合よく置き換える可能性があります。 + +## コンセプトの実証 + +以下は CVE-2014-2734 の分析です。オリジナルの PoC を縮小させることができました。これはコンセプトの実証の本質を捉えていると考えられます。 + +{% highlight ruby %} +require 'openssl' + +forge_key = OpenSSL::PKey::RSA.new(2048) +raw_certificate = File.read("arbitrary.cer") +cert = OpenSSL::X509::Certificate.new(raw_certificate) +resigned_cert = cert.sign(spoof, OpenSSL::Digest::SHA1.new) + +resigned_cert.verify(key) #=> true +{% endhighlight %} + +`X509Certificate#verify` が `true` を返してくることに驚くかもしれません。 +オリジナルの証明書には `forge_key` の公開鍵とは異なるオリジナルの公開鍵を指す[サブジェクト公開鍵情報](http://tools.ietf.org/html/rfc5280#section-4.1.2.7)が含まれている場合があります。 +証明書の再署名に使用された公開鍵と秘密鍵のペアは、サブジェクト公開鍵情報で参照されているオリジナルの公開鍵と明らかに一致しなくなりました。 +どうして `#verify` は ` true` を返すのでしょうか? + +### 鍵の検証方法 + +`X509Certificate#verify` は OpenSSL の[`X509_verify`](https://github.com/openssl/openssl/blob/master/crypto/x509/x_all.c#L74) 関数を利用しています(内部的には [`ASN1_item_verify`](https://github.com/openssl/openssl/blob/master/crypto/asn1/a_verify.c#L134) 関数を呼び出しています)。 +これらの関数は、提示された公開鍵を指定して署名の有効性を確立します。 +ところが、指定された鍵が証明書で参照されているサブジェクト公開鍵と実際に一致するかどうかは**検証されません**。 +これは、このシナリオでは「`X509Certificate#verify` の期待する振る舞いは `true` を返すこと」を意味します。 +このチェックを省略しても、総体的に X.509 信頼モデルのセキュリティに大きな影響はありません。 + +RFC 5280 の 4.1.1.3 項は、CA が証明書に含まれる情報の正確さを「証明書の署名を計算すること」で確認すると明記しています。 +上記のサンプルコードはこの原則に違反していますが、セキュリティを脅かすものではありません。 + +## 潜在的なリスク + +2 通り考えられます: + +### ルート証明書の再署名 + +ユーザーとして、私たちは無条件にルート証明書を信頼します。 +有効なな情報が含まれていない場合でも、公的に認められたルート証明書であるというステータスだけで、それらを元の状態に保つことができます。 +たとえば、OpenSSL 自体は同様の理由からデフォルトで自己署名ルート証明書の署名をチェックしません。 + +参考: [X509_V_FLAG_CHECK_SS_SIGNATURE documentation](https://www.openssl.org/docs/crypto/X509_VERIFY_PARAM_set_flags.html) + +再署名されたルート証明書は事実上の「自己署名」証明書になります(ただし、サブジェクト公開鍵情報は正しくありません)。 +これは正常な自己署名ルート証明書より危険ではありません。 +事実、署名がなければ、有効なルート証明書と完全に一致する可能性のある自己署名ルート証明書は誰でも作成できます。 +私たちは所有するだけでルート証明書を信頼するため、クライアントの「このルート証明書は信頼する」という積極的な同意がない限り、詐欺まがいな証明書に意味はありません。 + +### 中間証明書またはリーフ証明書の再署名 + +非ルート証明書の再署名もまた X.509 信頼モデルのセキュリティを脅かすものではありません。 +通常はこのような種類の証明書をあらかじめ所有していない限り、[パス検証手続き](http://tools.ietf.org/html/rfc5280#section-6)中にこのような偽装は検出されます。 +ここで、非ルート証明書の署名は、発行する証明書の公開鍵を使用して検証されます。 +証明書チェーンのある時点で、偽造は最終的に無効な証明書署名値という形で検出されます。 + +## まとめ + +結論として、`X509Certificate#verify` は期待どおりに動作すると考えています。 +私たち以外の誰かも自力で[同じ結論](https://github.com/adrienthebo/cve-2014-2734/)に行き着いたため、CVE-2014-2734 に異議を唱え、その取り消しを求めました。 +[オリジナルのコンセプトの実証](https://gist.github.com/emboss/91696b56cd227c8a0c13)は、コメントを含め、完全な分析結果として閲覧することができます。 From 45ecaadb25d8ea1460c51471750c22f227ea99f5 Mon Sep 17 00:00:00 2001 From: jinroq <2787780+jinroq@users.noreply.github.com> Date: Mon, 29 Nov 2021 00:05:49 +0900 Subject: [PATCH 0104/1090] Translate "OpenSSL Severe Vulnerability in TLS Heartbeat Extension (CVE-2014-0160)" (ja) Translate [https://github.com/ruby/www.ruby-lang.org/blob/master/en/news/_posts/2014-04-10-severe-openssl-vulnerability.md](https://github.com/ruby/www.ruby-lang.org/blob/master/en/news/_posts/2014-04-10-severe-openssl-vulnerability.md) to ja. --- ...2014-04-10-severe-openssl-vulnerability.md | 59 +++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 ja/news/_posts/2014-04-10-severe-openssl-vulnerability.md diff --git a/ja/news/_posts/2014-04-10-severe-openssl-vulnerability.md b/ja/news/_posts/2014-04-10-severe-openssl-vulnerability.md new file mode 100644 index 0000000000..98c992bfe7 --- /dev/null +++ b/ja/news/_posts/2014-04-10-severe-openssl-vulnerability.md @@ -0,0 +1,59 @@ +--- +layout: news_post +title: "OpenSSL の TLS ハートビート拡張による重大な脆弱性について(CVE-2014-0160)" +author: "hone and zzak" +translator: "jinroq" +date: 2014-04-10 01:04:27 +0000 +tags: security +lang: ja +--- + +OpenSSL の TLS/DTLS(トランスポート層セキュアプロトコル)ハートビート拡張(`RFC6520`)の実装で重大な脆弱性が発見されました。 +この脆弱性は [CVE-2014-0160](https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2014-0160) として登録されています。 + +サーバーからクライアントへ、およびクライアントからサーバーへのメモリの内容を利己的に開示される可能性があります。 +攻撃者は、SSL 暗号化に使用される秘密鍵や認証トークンなどを含む機密データをメモリから遠隔操作によって取得できます。 + +詳細は [heartbleed.com](http://heartbleed.com) を参照してください. + +## Ruby の影響範囲 + +Ruby は、標準添付ライブラリ OpenSSL の C 拡張機能を介した脆弱な OpenSSL のバージョンに対して静的コンパイルをされると影響を受けます。 + +バージョン 1.0.1 以上 1.0.1f 以下の OpenSSL がこの攻撃に対して脆弱です。 +Ruby にリンクしている OpenSSL ライブラリのバージョンを検証するには、以下を実行してください。 + +{% highlight sh %} +ruby -v -ropenssl -rfiddle -e 'puts Fiddle::Function.new(Fiddle.dlopen(nil)["SSLeay_version"], [Fiddle::TYPE_INT], Fiddle::TYPE_VOIDP).call(0)' +{% endhighlight %} + +Ruby を使って現在インストールされている OpenSSL のバージョンを確認するには、以下を実行してください。 + +{% highlight sh %} +ruby -ropenssl -e 'puts OpenSSL::OPENSSL_VERSION' +{% endhighlight %} + +[emboss のスクリプト](https://github.com/emboss/heartbeat)を使ってクライアントソフトウェア、または実行中のサービスが脆弱かどうかを確認できます。 + +## 解決策 + +最新版である OpenSSL バージョン `1.0.1g` もしくはそれ以降にアップグレードする必要があります。そのためには最新の OpenSSL が提供されているかを現在使っている OS パッケージ管理システムで確認する必要があります。 +利用可能なバージョン番号に関係なく、その OpenSSL のバージョンにパッチが適用されているかを確認するために、OS ディストリビューターに相談する必要があるかもしれません。 + +アップグレードがオプションではない場合、ビルド時に `-DOPENSSL_NO_HEARTBEATS` オプションを付け、パッチが適用されている OpenSSL を再コンパイルします。 + +アプグレードされている OpenSSL を使っているなら、脆弱なバージョンの OpenSSL へのリンクがないことを確認している Ruby を再コンパイルすることを推奨します。 + +これは、RVM や ruby-build のような Ruby をビルドするために使うツールを更新することを意味します。 +Ruby を自分でビルドする場合は、コンパイル時にアップグレードされた OpenSSL をインストールしているディレクトリにリンクするよう `--with-openssl-dir` オプションを使用してください。。 + +{% highlight sh %} +$ ./configure --with-openssl-dir=/path/to/openssl +$ make +$ make install +{% endhighlight %} + +OpenSSL と Ruby をアップグレードした後、脆弱なバージョンを使っている全てのプログラムを再起動することが重要です。 + +多くの OS ディストリビューションは、この攻撃に脆弱であるライブラリに対し、パッチを適用したバージョンと再構築されたパッケージをすでに提供しています(もしくは間もなく提供する予定です)。 +安全性を確保するために、OS ディストリビューターを監視することが重要です。 From 1951efd3308b9371d282d0c300e855a61fbe2177 Mon Sep 17 00:00:00 2001 From: jinroq <2787780+jinroq@users.noreply.github.com> Date: Sat, 4 Dec 2021 07:46:18 +0900 Subject: [PATCH 0105/1090] Revised in the review. --- ja/news/_posts/2021-07-07-starttls-stripping-in-net-imap.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ja/news/_posts/2021-07-07-starttls-stripping-in-net-imap.md b/ja/news/_posts/2021-07-07-starttls-stripping-in-net-imap.md index 6d2f0d0343..ca45ac42cd 100644 --- a/ja/news/_posts/2021-07-07-starttls-stripping-in-net-imap.md +++ b/ja/news/_posts/2021-07-07-starttls-stripping-in-net-imap.md @@ -12,7 +12,7 @@ Net::IMAP 内の StartTLS ストリッピングに脆弱性が発見されまし この脆弱性は [CVE-2021-32066](https://nvd.nist.gov/vuln/detail/CVE-2021-32066) として登録されています。 Ruby をアップグレードすることを強く推奨します。 -net-imap は Ruby 3.0.1 の デフォルト gem ですが、パッケージ化の問題があるため、Ruby 自体をアップグレードしてください。 +net-imap は Ruby 3.0.1 の デフォルト gem ですが、パッケージ化に問題があるため、Ruby 自体をアップグレードしてください。 ## 詳細 From 39180f8bf65f45aa3bdd132bdbeed34f7a14a73d Mon Sep 17 00:00:00 2001 From: jinroq <2787780+jinroq@users.noreply.github.com> Date: Sat, 4 Dec 2021 08:08:16 +0900 Subject: [PATCH 0106/1090] Revised in the review. --- ja/news/_posts/2021-07-07-starttls-stripping-in-net-imap.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ja/news/_posts/2021-07-07-starttls-stripping-in-net-imap.md b/ja/news/_posts/2021-07-07-starttls-stripping-in-net-imap.md index ca45ac42cd..0a54c65239 100644 --- a/ja/news/_posts/2021-07-07-starttls-stripping-in-net-imap.md +++ b/ja/news/_posts/2021-07-07-starttls-stripping-in-net-imap.md @@ -16,7 +16,7 @@ net-imap は Ruby 3.0.1 の デフォルト gem ですが、パッケージ化 ## 詳細 -Net::IMAP は、StartTLS が不明な応答で失敗した場合に例外を発生させません。これにより、中間者攻撃者がクライアントとレジストリ間のネットワークの場所を利用して StartTLS コマンドをブロックできる可能性があります。つまり、中間者攻撃者が TLS 保護をバイパスできる可能性があります。 +Net::IMAP は、StartTLS が不明な応答で失敗した場合に例外を発生させません。これにより、中間者攻撃者がクライアントとレジストリ間のネットワーク位置を利用して StartTLS コマンドをブロックし、結果として、中間者攻撃者が TLS 保護をバイパスできる可能性があります。 これは「StartTLS ストリッピング攻撃」とも呼ばれています。 ## 影響を受けるバージョン From c9dea54abfe645b9203e4b20003e082a95015e8b Mon Sep 17 00:00:00 2001 From: jinroq <2787780+jinroq@users.noreply.github.com> Date: Sat, 4 Dec 2021 21:36:05 +0900 Subject: [PATCH 0107/1090] Polished sentences. --- ...-xml-round-trip-vulnerability-in-rexml-cve-2021-28965.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ja/news/_posts/2021-04-05-xml-round-trip-vulnerability-in-rexml-cve-2021-28965.md b/ja/news/_posts/2021-04-05-xml-round-trip-vulnerability-in-rexml-cve-2021-28965.md index 65589d9ebe..db1112833a 100644 --- a/ja/news/_posts/2021-04-05-xml-round-trip-vulnerability-in-rexml-cve-2021-28965.md +++ b/ja/news/_posts/2021-04-05-xml-round-trip-vulnerability-in-rexml-cve-2021-28965.md @@ -1,6 +1,6 @@ --- layout: news_post -title: "CVE-2021-28965: REXML 内の XML ラウンドトリップの脆弱性について" +title: "CVE-2021-28965: REXML 内の XML ラウンドトリップ脆弱性について" author: "mame" translator: "jinroq" date: 2021-04-05 12:00:00 +0000 @@ -8,13 +8,13 @@ tags: security lang: ja --- -Ruby にバンドルされている REXML gem 内の XML ラウンドトリップに脆弱性が発見されました。 +Ruby にバンドルされている REXML gem 内の XML ラウンドトリップ脆弱性が発見されました。 この脆弱性は [CVE-2021-28965](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-28965) として登録されています。 REXML gem をアップグレードすることを強く推奨します。 ## 詳細 -加工された XML ドキュメントをパーシングおよびシリアル化する場合、REXML gem(Ruby にバンドルされているものを含む)は、元のドキュメントとは構造が異なる誤った XML ドキュメントを生成する可能性があります。 +特定の加工が施された XML ドキュメントをパーシングおよびシリアル化する場合、REXML gem(Ruby にバンドルされているものを含む)は、元のドキュメントとは構造が異なる誤った XML ドキュメントを生成する可能性があります。 この問題の影響はコンテキストによって大きく異なりますが、REXML を使用している一部のプログラムでは脆弱性が生じる可能性があります。 REXML gem をバージョン 3.2.5 以降に更新してください。 From 178e4af80f26aabe7cc3edf365dc395994338616 Mon Sep 17 00:00:00 2001 From: jinroq <2787780+jinroq@users.noreply.github.com> Date: Mon, 6 Dec 2021 12:07:14 +0900 Subject: [PATCH 0108/1090] Revised points made in reviews. Revised the points made in [this comment](https://github.com/ruby/www.ruby-lang.org/pull/2747). --- ...4-05-xml-round-trip-vulnerability-in-rexml-cve-2021-28965.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ja/news/_posts/2021-04-05-xml-round-trip-vulnerability-in-rexml-cve-2021-28965.md b/ja/news/_posts/2021-04-05-xml-round-trip-vulnerability-in-rexml-cve-2021-28965.md index db1112833a..a30f112f91 100644 --- a/ja/news/_posts/2021-04-05-xml-round-trip-vulnerability-in-rexml-cve-2021-28965.md +++ b/ja/news/_posts/2021-04-05-xml-round-trip-vulnerability-in-rexml-cve-2021-28965.md @@ -8,7 +8,7 @@ tags: security lang: ja --- -Ruby にバンドルされている REXML gem 内の XML ラウンドトリップ脆弱性が発見されました。 +Ruby にバンドルされている REXML gem に XML ラウンドトリップ脆弱性が発見されました。 この脆弱性は [CVE-2021-28965](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-28965) として登録されています。 REXML gem をアップグレードすることを強く推奨します。 From 93192c190415158183f702a6fcad0838dc975568 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladimir=20T=C3=A1mara=20Pati=C3=B1o?= Date: Mon, 6 Dec 2021 14:35:10 -0500 Subject: [PATCH 0109/1090] Translation of CVE-2021-41817 to spanish (#2758) * Translation of CVE-2021-41817 to spanish * No blank line at end * Update es/news/_posts/2021-11-15-date-parsing-method-regexp-dos-cve-2021-41817.md Co-authored-by: Gustavo Villa * Update es/news/_posts/2021-11-15-date-parsing-method-regexp-dos-cve-2021-41817.md Co-authored-by: Gustavo Villa * Update es/news/_posts/2021-11-15-date-parsing-method-regexp-dos-cve-2021-41817.md Co-authored-by: Gustavo Villa * Update es/news/_posts/2021-11-15-date-parsing-method-regexp-dos-cve-2021-41817.md Co-authored-by: Gustavo Villa * Update es/news/_posts/2021-11-15-date-parsing-method-regexp-dos-cve-2021-41817.md Co-authored-by: Gustavo Villa * Update es/news/_posts/2021-11-15-date-parsing-method-regexp-dos-cve-2021-41817.md Co-authored-by: Gustavo Villa * Update es/news/_posts/2021-11-15-date-parsing-method-regexp-dos-cve-2021-41817.md Co-authored-by: Gustavo Villa * Update es/news/_posts/2021-11-15-date-parsing-method-regexp-dos-cve-2021-41817.md Co-authored-by: Gustavo Villa Co-authored-by: Gustavo Villa --- ...p-vulnerability-in-rexml-cve-2021-28965.md | 2 +- ...arsing-method-regexp-dos-cve-2021-41817.md | 57 +++++++++++++++++++ 2 files changed, 58 insertions(+), 1 deletion(-) create mode 100644 es/news/_posts/2021-11-15-date-parsing-method-regexp-dos-cve-2021-41817.md diff --git a/es/news/_posts/2021-04-05-xml-round-trip-vulnerability-in-rexml-cve-2021-28965.md b/es/news/_posts/2021-04-05-xml-round-trip-vulnerability-in-rexml-cve-2021-28965.md index fcc342219d..325205277b 100644 --- a/es/news/_posts/2021-04-05-xml-round-trip-vulnerability-in-rexml-cve-2021-28965.md +++ b/es/news/_posts/2021-04-05-xml-round-trip-vulnerability-in-rexml-cve-2021-28965.md @@ -41,7 +41,7 @@ posterior tan pronto como sea posible. ## Versiones afectadas -* Ruby 2.5.8 o anterior (NO podrá usar `gem upgrade rexml` +* Ruby 2.5.8 o anterior (NO podrá usar `gem update rexml` con estas versiones.) * Ruby 2.6.6 o anterior * Ruby 2.7.2 o anterior diff --git a/es/news/_posts/2021-11-15-date-parsing-method-regexp-dos-cve-2021-41817.md b/es/news/_posts/2021-11-15-date-parsing-method-regexp-dos-cve-2021-41817.md new file mode 100644 index 0000000000..8f1bacc61e --- /dev/null +++ b/es/news/_posts/2021-11-15-date-parsing-method-regexp-dos-cve-2021-41817.md @@ -0,0 +1,57 @@ +--- +layout: news_post +title: "CVE-2021-41817: Vulnerabilidad de denegación de servicio por Expresiones Reguales en los métodos para reconocer fechas" +author: "mame" +translator: vtamara +date: 2021-11-15 08:00:00 +0000 +tags: security +lang: es +--- + +Hemos publicado la gema `date` con versiones 3.2.1, 3.1.2, 3.0.2 y 2.0.1 +que incluyen una corrección de seguridad a una vulnerabilidad de denegación +de servicio por expresiones regulares (ReDoS) en los métodos para reconocer +fechas. +Un atacante podría explotar esta vulnerabilidad para generar +un ataque de denegación de servicio efectivo. + +A esta vulnerabilidad se le ha asignado el identificador CVE +[CVE-2021-41817](https://nvd.nist.gov/vuln/detail/CVE-2021-41817). + +## Detalles + +Los métodos para reconocer fechas incluyendo `Date.parse` usan +expresiones regulares internamente, algunas de las cuales son vulnerables +a denegación de servicio por expresiones regulares. +Las aplicaciones y librerías que emplean tales métodos con entradas +no confiables pueden verse afectadas. + +La corrección limita el tamaño de la entrada a 128 bytes de manera +predeterminada en lugar de cambiar las expresiones regulares. +Esto es porque la gema Date usa muchas expresiones regulares y es posible que aún haya +vulnerabilidades no descubiertas en algunas. Por compatibilidad, se +permite eliminar la limitación pasando explícitamente la palabra +reservada `limit` en `nil`, como en `Date.parse(str, limit: nil)`, +pero tenga en cuenta que el reconocimiento puede tardar un largo tiempo. + +Por favor actualice la gema date a una de las versiones 3.2.1, 3.1.2, 3.0.2, +2.0.1 o posterior. Puede usar `gem update date` para actualizarla. +Si usa bundler, por favor añada `gem "date", ">= 3.2.1"` a su `Gemfile`. +De forma alternativa, puede actualizar Ruby a 3.0.3, 2.7.5, 2.6.9 o posterior. + +## Versiones afectadas + +* gema date 2.0.0 y anteriores (distribuidas con la serie Ruby 2.6 antes de Ruby 2.6.9) +* gema date 3.0.1 y anteriores (distribuidas con la serie Ruby 2.7 antes de Ruby 2.7.5) +* gema date 3.1.1 y anteriores (distribuida con la serie Ruby 3.0 antes de Ruby 3.0.3) +* gema date gem 3.2.0 y anteriores + +## Créditos + +Agradecemos a [svalkanov](https://github.com/SValkanov/) por descubrir +el problema. + +## Historia + +* Publicado originalmente en inglés el 2021-11-15 08:00:00 (UTC) +* Mención sobre nuevas versiones de Ruby el 2021-11-24 13:20:00 (UTC) From 75c9ef329eb90cd5411df8e7fa9f3da49a32f1de Mon Sep 17 00:00:00 2001 From: Andrias Meisyal Date: Sat, 4 Dec 2021 20:23:33 +0700 Subject: [PATCH 0110/1090] Translate CVE-2021-32066: A StartTLS stripping vulnerability in Net::IMAP (id) --- ...21-07-07-starttls-stripping-in-net-imap.md | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 id/news/_posts/2021-07-07-starttls-stripping-in-net-imap.md diff --git a/id/news/_posts/2021-07-07-starttls-stripping-in-net-imap.md b/id/news/_posts/2021-07-07-starttls-stripping-in-net-imap.md new file mode 100644 index 0000000000..0e83033da3 --- /dev/null +++ b/id/news/_posts/2021-07-07-starttls-stripping-in-net-imap.md @@ -0,0 +1,40 @@ +--- +layout: news_post +title: "CVE-2021-32066: Kerentanan StartTLS stripping pada Net::IMAP" +author: "shugo" +translator: "meisyal" +date: 2021-07-07 09:00:00 +0000 +tags: security +lang: id +--- + +Sebuah kerentanan StartTLS *stripping* telah ditemukan pada Net::IMAP. +Kerentanan ini telah ditetapkan dengan penanda CVE +[CVE-2021-32066](https://nvd.nist.gov/vuln/detail/CVE-2021-32066). +Kami sangat merekomendasikan untuk memperbarui Ruby. + +net-imap adalah sebuah *default gem* pada Ruby 3.0.1, tetapi *gem* tersebut +memiliki masalah pengemasan. Sehingga, mohon perbarui Ruby. + +## Detail + +Net::IMAP tidak akan mengeluarkan sebuah *exception* jika StartTLS gagal +dengan sebuah respons yang tidak dikenal, yang mana mungkin memperbolehkan +penyerang *man-in-the-middle* untuk melewati perlindungan TLS dengan +memanfaatkan posisi jaringan antara *client* dan *registry* untuk mengeblok +perintah StartTLS, alias "StartTLS stripping attack." + +## Versi Terimbas + +* Rangkaian Ruby 2.6: 2.6.7 dan sebelumnya +* Rangkaian Ruby 2.7: 2.7.3 dan sebelumnya +* Rangkaian Ruby 3.0: 3.0.1 dan sebelumnya + +## Rujukan + +Terima kasih kepada [Alexandr Savca](https://hackerone.com/chinarulezzz) yang +telah melaporkan kerentanan ini. + +## Riwayat + +* Semula dipublikasikan pada 2021-07-07 09:00:00 UTC From 6a7c5e36a74e64d4b689bb89908be5fa68f1a19a Mon Sep 17 00:00:00 2001 From: billaul Date: Sun, 19 Dec 2021 17:22:33 +0100 Subject: [PATCH 0111/1090] Update index.md --- fr/community/index.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/fr/community/index.md b/fr/community/index.md index 97898265cd..984296a32d 100644 --- a/fr/community/index.md +++ b/fr/community/index.md @@ -25,6 +25,12 @@ Quelques liens à visiter: disponibles. Si vous avez des questions sur Ruby, les poser sur une de ces listes est un moyen efficace pour obtenir rapidement des réponses. +[Server Discord Ruby (lien d'invitation)][ruby-discord] +: Le serveur Discord Ruby est un endroit où vous pouvez discuter avec + d'autres rubyistes, obtenir de l'aide pour vos questions sur Ruby ou + aider les autres. Discord est un bon point d'entrée pour les nouveaux + développeurs et il est facile à rejoindre. + [IRC (#ruby)](https://web.libera.chat/#ruby) : Le canal IRC anglophone #ruby est un endroit fantastique pour discuter en temps réel avec d’autres rubyistes. @@ -53,5 +59,6 @@ Informations générales [ruby-central]: http://rubycentral.org/ +[ruby-discord]: https://ruby-discord.com/ [ruby-opendir]: https://dmoztools.net/Computers/Programming/Languages/Ruby/ [rails-opendir]: https://dmoztools.net/Computers/Programming/Languages/Ruby/Software/Frameworks/Rails/ From 840bad163a6756708734b5d7626e037c83fc95ff Mon Sep 17 00:00:00 2001 From: Andrias Meisyal Date: Sat, 18 Dec 2021 20:23:19 +0700 Subject: [PATCH 0112/1090] Translate Ruby 2.6.8 released news (id) --- .../_posts/2021-07-07-ruby-2-6-8-released.md | 64 +++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 id/news/_posts/2021-07-07-ruby-2-6-8-released.md diff --git a/id/news/_posts/2021-07-07-ruby-2-6-8-released.md b/id/news/_posts/2021-07-07-ruby-2-6-8-released.md new file mode 100644 index 0000000000..0b922bfdcc --- /dev/null +++ b/id/news/_posts/2021-07-07-ruby-2-6-8-released.md @@ -0,0 +1,64 @@ +--- +layout: news_post +title: "Ruby 2.6.8 Dirilis" +author: "usa" +translator: "meisyal" +date: 2021-07-07 09:00:00 +0000 +lang: id +--- + +Ruby 2.6.8 telah dirilis. + +Rilis ini memuat perbaikan keamanan. +Mohon cek topik-topik di bawah ini untuk lebih detail. + +* [CVE-2021-31810: Kerentanan respons FTP PASV yang dipercaya pada Net::FTP]({%link id/news/_posts/2021-07-07-trusting-pasv-responses-in-net-ftp.md %}) +* [CVE-2021-32066: Kerentanan StartTLS stripping pada Net::IMAP]({%link id/news/_posts/2021-07-07-starttls-stripping-in-net-imap.md %}) +* [CVE-2021-31799: Sebuah kerentanan command injection pada RDoc]({%link id/news/_posts/2021-05-02-os-command-injection-in-rdoc.md %}) + +Kami biasanya tidak memperbaiki Ruby 2.6, kecuali perbaikan keamanan. Tetapi, +rilis ini memuat beberapa perbaikan *regressed bug* dan *build problem*. +Lihat [commit logs](https://github.com/ruby/ruby/compare/v2_6_7...v2_6_8) +untuk detail. + +Ruby 2.6 saat ini berada pada fase perawatan keamanan hingga akhir Maret 2022. +Setelah bulan tersebut, perawatan Ruby 2.6 akan berakhir. +Kami merekomendasikan Anda untuk mulai merencanakan migrasi ke Ruby versi +terbaru, seperti 3.0 atau 2.7. + +## Unduh + +{% assign release = site.data.releases | where: "version", "2.6.8" | first %} + +* <{{ release.url.bz2 }}> + + SIZE: {{ release.size.bz2 }} + SHA1: {{ release.sha1.bz2 }} + SHA256: {{ release.sha256.bz2 }} + SHA512: {{ release.sha512.bz2 }} + +* <{{ release.url.gz }}> + + SIZE: {{ release.size.gz }} + SHA1: {{ release.sha1.gz }} + SHA256: {{ release.sha256.gz }} + SHA512: {{ release.sha512.gz }} + +* <{{ release.url.xz }}> + + SIZE: {{ release.size.xz }} + SHA1: {{ release.sha1.xz }} + SHA256: {{ release.sha256.xz }} + SHA512: {{ release.sha512.xz }} + +* <{{ release.url.zip }}> + + SIZE: {{ release.size.zip }} + SHA1: {{ release.sha1.zip }} + SHA256: {{ release.sha256.zip }} + SHA512: {{ release.sha512.zip }} + +## Komentar Rilis + +Banyak *committer*, pengembang, dan pengguna yang telah menyediakan laporan +*bug* membantu kami untuk membuat rilis ini. Terima kasih atas kontribusinya. From f1e7ad610a7aa5a5e48b4894a6c8b9b205b5afbe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladimir=20T=C3=A1mara=20Pati=C3=B1o?= Date: Wed, 22 Dec 2021 15:57:40 -0500 Subject: [PATCH 0113/1090] Translation of CVE 2021 41816 to spanish (#2760) * Translation of CVE 2021 41816 to spanish * lang es --- ...errun-in-cgi-escape_html-cve-2021-41816.md | 46 +++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 es/news/_posts/2021-11-24-buffer-overrun-in-cgi-escape_html-cve-2021-41816.md diff --git a/es/news/_posts/2021-11-24-buffer-overrun-in-cgi-escape_html-cve-2021-41816.md b/es/news/_posts/2021-11-24-buffer-overrun-in-cgi-escape_html-cve-2021-41816.md new file mode 100644 index 0000000000..6a64284388 --- /dev/null +++ b/es/news/_posts/2021-11-24-buffer-overrun-in-cgi-escape_html-cve-2021-41816.md @@ -0,0 +1,46 @@ +--- +layout: news_post +title: "CVE-2021-41816: Desbordamiento de búfer en CGI.escape_html" +author: "mame" +translator: vtamara +date: 2021-11-24 12:00:00 +0000 +tags: security +lang: es +--- + +Una vulnerabilidad de desbordamiento de búfer fue descubierta en +CGI.escape_html. +A esta vulnerabilidad se le ha asignado el identificador CVE +[CVE-2021-41816](https://nvd.nist.gov/vuln/detail/CVE-2021-41816). +Recomendamos enfáticamente actualizar Ruby. + +## Detalles + +Una vulnerabilidad de seguridad que causa desbordamientos de búfer cuando +el usuario pasa una cadenas muy grande (> 700MB) a `CGI.escape_html` en +una plataforma donde el tipo `long` emplee 4 bytes, tipicamente, Windows. + +Por favor actualice la gema cgi a la versión 0.3.1, 0.2,1, y 0.1,1 o posterior. +Puede usar `gem update cgi` para actualizarla. Si está usando bundler, +por favor añada `gem "cgi", ">= 0.3.1"` a su archivo `Gemfile`. +Alternativamente, por favor actualice Ruby a 2.7.5 o a 3.0.3. + +Este problema fue introducido desde Ruby 2.7, así que las versiones de cgi +incorporadas en Ruby 2.6 no es vulnerable. + +## Versiones afectadas + +* Gema cgi 0.1.0 o anterior (que se distribuyó con la serie Ruby 2.7 antes de + Ruby 2.7.5) +* Gema cgi 0.2.0 o anterior (que se distribuyó con la serie Ruby 3.0 antes de + Ruby 3.0.3) +* Gema cgi 0.3.0 o anterior + +## Créditos + +Agradecimientos a [chamal](https://hackerone.com/chamal) por descubrir este +problema. + +## Historia + +* Publicado originalmente el 2021-11-24 12:00:00 (UTC) From b923ddb8c6558223d1f691749d21985022132c6b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladimir=20T=C3=A1mara=20Pati=C3=B1o?= Date: Thu, 23 Dec 2021 09:38:46 -0500 Subject: [PATCH 0114/1090] Translation of CVE 2021-41819 to spanish (#2763) --- ...fing-in-cgi-cookie-parse-cve-2021-41819.md | 59 +++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 es/news/_posts/2021-11-24-cookie-prefix-spoofing-in-cgi-cookie-parse-cve-2021-41819.md diff --git a/es/news/_posts/2021-11-24-cookie-prefix-spoofing-in-cgi-cookie-parse-cve-2021-41819.md b/es/news/_posts/2021-11-24-cookie-prefix-spoofing-in-cgi-cookie-parse-cve-2021-41819.md new file mode 100644 index 0000000000..2648f13314 --- /dev/null +++ b/es/news/_posts/2021-11-24-cookie-prefix-spoofing-in-cgi-cookie-parse-cve-2021-41819.md @@ -0,0 +1,59 @@ +--- +layout: news_post +title: "CVE-2021-41819: Cookie Prefix Spoofing in CGI::Cookie.parse" +author: "mame" +translator: vtamara +date: 2021-11-24 12:00:00 +0000 +tags: security +lang: es +--- + +Se descubrió una vulnerabilidad de suplantación de identidad de prefijos de +galletas (cookies) en CGI::Cookie.parse. +A esta vulnerabilidad se el ha asignado el identificador +CVE [CVE-2021-41819](https://nvd.nist.gov/vuln/detail/CVE-2021-41819). +Recomendamos con énfasis actualizar Ruby. + +## Detalles + +La antigua versión de `CGI::Cookie.parse` aplicaba decodificación de URL a los +nombres de galletas. +Un atacante podría explotar esta vulnerabilidad para suplantar prefijos de +seguridad en los nombres de las galletas, que podría permitirle engañar +a una aplicación vulnerable. + +Con este arreglo, `CGI::Cookie.parse` ya no decodifica los nombres +de las galletas. +Note que esto es una incompatibilidad si los nombres de galletas que +está usando incluyendo carácteres no alfanuméricos que no están +codificados como URL. + +Este es el mismo incidente [CVE-2020-8184](https://nvd.nist.gov/vuln/detail/CVE-2020-8184). + +Si está usando Ruby 2.7 o 3.0: + +* Por favor actualice la gema cgi a la versión 0.3.1, 0.2,1, y 0.1,1 + o posterior. Puede usar `gem update cgi` para actualizarla. Si usa + bundler por favor agregue `gem "cgi", ">= 0.3.1"` a su `Gemfile`. +* De manera alternativa, por favor actualice Ruby a 2.7.5 o 3.0.3. + +Si usa Ruby 2.6: + +* Por favor actualice Ruby a 2.6.9. *No puede usar `gem update cgi` con Ruby 2.6 + o anteriores.* + +## Versiones afectadas + +* ruby 2.6.8 o anteriores (*No* puede usar `gem update cgi` para esta versión.) +* Gema cgi 0.1.0 o anteriores (que son versiones incorporadas en la serie Ruby 2.7 antes de Ruby 2.7.5) +* Gema cgi 0.2.0 o anteriores (que son versiones incorporadas en la serie Ruby 3.0 antes de Ruby 3.0.3) +* Gema cgi 0.3.0 o anteriores + +## Créditos + +Agradecemos a [ooooooo_q](https://hackerone.com/ooooooo_q) por descubrir +este problema. + +## Historia + +* Publicado originalmente el 2021-11-24 12:00:00 (UTC) From 0df598db6ec35d2f8c9070e448110a354a78952a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladimir=20T=C3=A1mara=20Pati=C3=B1o?= Date: Thu, 23 Dec 2021 11:53:56 -0500 Subject: [PATCH 0115/1090] Translation of release of Ruby 2.6.9, 2.7.5 and 3.0.3 to spanish (#2764) --- ...fing-in-cgi-cookie-parse-cve-2021-41819.md | 2 +- .../_posts/2021-11-24-ruby-2-6-9-released.md | 63 +++++++++++++++++++ .../_posts/2021-11-24-ruby-2-7-5-released.md | 63 +++++++++++++++++++ .../_posts/2021-11-24-ruby-3-0-3-released.md | 60 ++++++++++++++++++ 4 files changed, 187 insertions(+), 1 deletion(-) create mode 100644 es/news/_posts/2021-11-24-ruby-2-6-9-released.md create mode 100644 es/news/_posts/2021-11-24-ruby-2-7-5-released.md create mode 100644 es/news/_posts/2021-11-24-ruby-3-0-3-released.md diff --git a/es/news/_posts/2021-11-24-cookie-prefix-spoofing-in-cgi-cookie-parse-cve-2021-41819.md b/es/news/_posts/2021-11-24-cookie-prefix-spoofing-in-cgi-cookie-parse-cve-2021-41819.md index 2648f13314..664dbe5b00 100644 --- a/es/news/_posts/2021-11-24-cookie-prefix-spoofing-in-cgi-cookie-parse-cve-2021-41819.md +++ b/es/news/_posts/2021-11-24-cookie-prefix-spoofing-in-cgi-cookie-parse-cve-2021-41819.md @@ -1,6 +1,6 @@ --- layout: news_post -title: "CVE-2021-41819: Cookie Prefix Spoofing in CGI::Cookie.parse" +title: "CVE-2021-41819: Suplantación de identidad del prefijo de galletas en CGI::Cookie.parse" author: "mame" translator: vtamara date: 2021-11-24 12:00:00 +0000 diff --git a/es/news/_posts/2021-11-24-ruby-2-6-9-released.md b/es/news/_posts/2021-11-24-ruby-2-6-9-released.md new file mode 100644 index 0000000000..62f48cbae2 --- /dev/null +++ b/es/news/_posts/2021-11-24-ruby-2-6-9-released.md @@ -0,0 +1,63 @@ +--- +layout: news_post +title: "Publicado Ruby 2.6.9" +author: "usa" +translator: vtamara +date: 2021-11-24 12:00:00 +0000 +lang: es +--- + +Ruby 2.6.9 ha sido publicado. +CVE-2021-41819: Suplantación de identidad del prefijo de galletas en CGI::Cookie.parse +Esta versión incluye correcciones de seguridad. +Por favor revise los temas siguientes para ver detalles. +Please check the topics below for details. + +* [CVE-2021-41817: Vulnerabilidad de denegación de servicio por Expresiones Reguales en los métodos para reconocer fechas]({%link es/news/_posts/2021-11-15-date-parsing-method-regexp-dos-cve-2021-41817.md %}) +* [CVE-2021-41819: Suplantación de identidad del prefijo de galletas en CGI::Cookie.parse]({%link es/news/_posts/2021-11-24-cookie-prefix-spoofing-in-cgi-cookie-parse-cve-2021-41819.md %}) + +Ver detalles en la [bitácora de cambios](https://github.com/ruby/ruby/compare/v2_6_8...v2_6_9). + +Ruby 2.6 ahora está en la fase de mantenimiento de seguridad, hasta el final +de Marzo de 2022. +Tras esa fecha, cesará el mantenimiento a Ruby 2.6. +Le recomendamos empezar a planear la migración a una versińo más +reciente de ruby, tal como 3.0 o 2.7. + +## Descargas + +{% assign release = site.data.releases | where: "version", "2.6.9" | first %} + +* <{{ release.url.bz2 }}> + + SIZE: {{ release.size.bz2 }} + SHA1: {{ release.sha1.bz2 }} + SHA256: {{ release.sha256.bz2 }} + SHA512: {{ release.sha512.bz2 }} + +* <{{ release.url.gz }}> + + SIZE: {{ release.size.gz }} + SHA1: {{ release.sha1.gz }} + SHA256: {{ release.sha256.gz }} + SHA512: {{ release.sha512.gz }} + +* <{{ release.url.xz }}> + + SIZE: {{ release.size.xz }} + SHA1: {{ release.sha1.xz }} + SHA256: {{ release.sha256.xz }} + SHA512: {{ release.sha512.xz }} + +* <{{ release.url.zip }}> + + SIZE: {{ release.size.zip }} + SHA1: {{ release.sha1.zip }} + SHA256: {{ release.sha256.zip }} + SHA512: {{ release.sha512.zip }} + +## Comentario de la versión + +Muchos contribuidores, desarrolladores y usuarios proveyeron reportes +de fallas que ayudaron a completar esta versión. +Gracias por sus contribuciones. diff --git a/es/news/_posts/2021-11-24-ruby-2-7-5-released.md b/es/news/_posts/2021-11-24-ruby-2-7-5-released.md new file mode 100644 index 0000000000..641d91f64f --- /dev/null +++ b/es/news/_posts/2021-11-24-ruby-2-7-5-released.md @@ -0,0 +1,63 @@ +--- +layout: news_post +title: "Publicado Ruby 2.7.5" +author: "usa" +translator: vtamara +date: 2021-11-24 12:00:00 +0000 +lang: es +--- + +Ruby 2.7.5 ha sido publicado. + +Esta versión incluye correcciones de seguridad. +Por favor revise los temas siguientes para ver detalles. + +* [CVE-2021-41817: Vulnerabilidad de denegación de servicio por Expresiones Reguales en los métodos para reconocer fechas]({%link es/news/_posts/2021-11-15-date-parsing-method-regexp-dos-cve-2021-41817.md %}) +* [CVE-2021-41819: Suplantación de identidad del prefijo de galletas en CGI::Cookie.parse]({%link es/news/_posts/2021-11-24-cookie-prefix-spoofing-in-cgi-cookie-parse-cve-2021-41819.md %}) +* [CVE-2021-41816: Desbordamiento de búfer en CGI.escape_html]({%link es/news/_posts/2021-11-24-buffer-overrun-in-cgi-escape_html-cve-2021-41816.md %}) + +Ver detalles en la +[bitácora de cambios](https://github.com/ruby/ruby/compare/v2_7_4...v2_7_5). + + +## Descargas + +{% assign release = site.data.releases | where: "version", "2.7.5" | first %} + + +* <{{ release.url.bz2 }}> + + SIZE: {{ release.size.bz2 }} + SHA1: {{ release.sha1.bz2 }} + SHA256: {{ release.sha256.bz2 }} + SHA512: {{ release.sha512.bz2 }} + +* <{{ release.url.gz }}> + + SIZE: {{ release.size.gz }} + SHA1: {{ release.sha1.gz }} + SHA256: {{ release.sha256.gz }} + SHA512: {{ release.sha512.gz }} + +* <{{ release.url.xz }}> + + SIZE: {{ release.size.xz }} + SHA1: {{ release.sha1.xz }} + SHA256: {{ release.sha256.xz }} + SHA512: {{ release.sha512.xz }} + +* <{{ release.url.zip }}> + + SIZE: {{ release.size.zip }} + SHA1: {{ release.sha1.zip }} + SHA256: {{ release.sha256.zip }} + SHA512: {{ release.sha512.zip }} + +## Comentario de la versión + +Muchos contribuidores, desarrolladores y usuarios proveyeron reportes +de fallas que nos ayudaron a completar esta versión. +Gracias por sus contribuciones. + +El mantenimiento de Ruby 2.7, incluida esta versión, se basa en el "Acuerdo +para una versión estable de Ruby" de la Asociación Ruby. diff --git a/es/news/_posts/2021-11-24-ruby-3-0-3-released.md b/es/news/_posts/2021-11-24-ruby-3-0-3-released.md new file mode 100644 index 0000000000..1836129518 --- /dev/null +++ b/es/news/_posts/2021-11-24-ruby-3-0-3-released.md @@ -0,0 +1,60 @@ +--- +layout: news_post +title: "Publicación de Ruby 3.0.3" +author: "nagachika" +translator: vtamara +date: 2021-11-24 12:00:00 +0000 +lang: es +--- + +Ruby 3.0.3 ha sido publicado. + +Esta versión incluye correcciones de seguridad. +Por favor revise los temas siguientes para ver detalles. + +* [CVE-2021-41817: Vulnerabilidad de denegación de servicio por Expresiones Reguales en los métodos para reconocer fechas]({%link es/news/_posts/2021-11-15-date-parsing-method-regexp-dos-cve-2021-41817.md %}) +* [CVE-2021-41816: Desbordamiento de búfer en CGI.escape_html]({%link es/news/_posts/2021-11-24-buffer-overrun-in-cgi-escape_html-cve-2021-41816.md %}) +* [CVE-2021-41819: Suplantación de identidad del prefijo de galletas en CGI::Cookie.parse]({%link es/news/_posts/2021-11-24-cookie-prefix-spoofing-in-cgi-cookie-parse-cve-2021-41819.md %}) + +Ver detalles en la +[bitácora de cambios](https://github.com/ruby/ruby/compare/v2_7_4...v2_7_5). + + +## Descargas + +{% assign release = site.data.releases | where: "version", "3.0.3" | first %} + + +* <{{ release.url.bz2 }}> + + SIZE: {{ release.size.bz2 }} + SHA1: {{ release.sha1.bz2 }} + SHA256: {{ release.sha256.bz2 }} + SHA512: {{ release.sha512.bz2 }} + +* <{{ release.url.gz }}> + + SIZE: {{ release.size.gz }} + SHA1: {{ release.sha1.gz }} + SHA256: {{ release.sha256.gz }} + SHA512: {{ release.sha512.gz }} + +* <{{ release.url.xz }}> + + SIZE: {{ release.size.xz }} + SHA1: {{ release.sha1.xz }} + SHA256: {{ release.sha256.xz }} + SHA512: {{ release.sha512.xz }} + +* <{{ release.url.zip }}> + + SIZE: {{ release.size.zip }} + SHA1: {{ release.sha1.zip }} + SHA256: {{ release.sha256.zip }} + SHA512: {{ release.sha512.zip }} + +## Comentario de la versión + +Muchos contribuidores, desarrolladores y usuarios proveyeron reportes +de fallas que nos ayudaron a completar esta versión. +Gracias por sus contribuciones. From af3e0d344a11738ea684d0c2cf5e662f9f934228 Mon Sep 17 00:00:00 2001 From: "NARUSE, Yui" Date: Sat, 25 Dec 2021 19:59:44 +0900 Subject: [PATCH 0116/1090] Ruby 3.1.0 Released (#2765) --- _data/branches.yml | 4 +- _data/downloads.yml | 2 +- _data/releases.yml | 24 ++ .../_posts/2021-12-25-ruby-3-1-0-released.md | 259 ++++++++++++++++++ .../_posts/2021-12-25-ruby-3-1-0-released.md | 256 +++++++++++++++++ 5 files changed, 542 insertions(+), 3 deletions(-) create mode 100644 en/news/_posts/2021-12-25-ruby-3-1-0-released.md create mode 100644 ja/news/_posts/2021-12-25-ruby-3-1-0-released.md diff --git a/_data/branches.yml b/_data/branches.yml index ebd2220b93..a4054fb534 100644 --- a/_data/branches.yml +++ b/_data/branches.yml @@ -9,8 +9,8 @@ # eol_date: date of EOL (YYYY-MM-DD) - name: 3.1 - status: preview - date: + status: normal maintenance + date: 2021-12-25 eol_date: - name: 3.0 diff --git a/_data/downloads.yml b/_data/downloads.yml index 54a2601a06..10644898d1 100644 --- a/_data/downloads.yml +++ b/_data/downloads.yml @@ -4,10 +4,10 @@ # optional preview: - - 3.1.0-preview1 stable: + - 3.1.0 - 3.0.3 - 2.7.5 diff --git a/_data/releases.yml b/_data/releases.yml index 82ff598065..a7a6341109 100644 --- a/_data/releases.yml +++ b/_data/releases.yml @@ -21,6 +21,30 @@ # 3.1 series +- version: 3.1.0 + date: 2021-12-25 + post: /en/news/2021/12/25/ruby-3-1-0-released/ + url: + gz: https://cache.ruby-lang.org/pub/ruby/3.1/ruby-3.1.0.tar.gz + zip: https://cache.ruby-lang.org/pub/ruby/3.1/ruby-3.1.0.zip + xz: https://cache.ruby-lang.org/pub/ruby/3.1/ruby-3.1.0.tar.xz + size: + gz: 19204319 + zip: 23207824 + xz: 14051880 + sha1: + gz: 3945f8043286975cfc016d288abcb334574796d9 + zip: 88963d8244bb122668c1fc8dfa3a8a5289c87146 + xz: 3d5a9cae293763787185ccc04f05aecfb6790703 + sha256: + gz: 8dc75f2f7b5552a3a10abc22ffbf1bf85909326d715647dcdf5ce878c349a81d + zip: 8a051fdd5ba43bd072c3179bbc65c581974c06142b97aa049fe04ec6d5fc8447 + xz: 8594c076e1b06a896143d3a70163ddc12d81ca55c906ee5ee215587c2df52382 + sha512: + gz: ede15d99afb3087412a45038ad9266af67edc953fae08356a64235706766d171715bc927b045e1b07d0736cdf83f1891944b6861dad39f4519482135493cc93c + zip: f52ea893e158d79074ab7f551778df2189c184bc7b931e27ad0e7600ceab743d88d8b07ba3ff400b65c7866aa62734b72efe89216d5c4106391b40476f0d30ac + xz: 0ef0c19b6ae5af9878d8783a7b072e7f86c6d0e747866365564891c94452f334c901419bba80b6361c803c031ffa6b98d237eb4c6e017f8e6fe652cc336572de + - version: 3.1.0-preview1 date: 2021-11-09 post: /en/news/2021/11/09/ruby-3-1-0-preview1-released/ diff --git a/en/news/_posts/2021-12-25-ruby-3-1-0-released.md b/en/news/_posts/2021-12-25-ruby-3-1-0-released.md new file mode 100644 index 0000000000..caf363cc42 --- /dev/null +++ b/en/news/_posts/2021-12-25-ruby-3-1-0-released.md @@ -0,0 +1,259 @@ +--- +layout: news_post +title: "Ruby 3.1.0 Released" +author: "naruse" +translator: +date: 2021-12-25 00:00:00 +0000 +lang: en +--- + +{% assign release = site.data.releases | where: "version", "3.1.0" | first %} + +We are pleased to announce the release of Ruby {{ release.version }}. + + +## YJIT: New experimental in-process JIT compiler + + +Ruby 3.1 merges YJIT, a new in-process JIT compiler developed by Shopify. + +Since [Ruby 2.6 introduced MJIT in 2018](https://www.ruby-lang.org/en/news/2018/12/25/ruby-2-6-0-released/), its performance greatly improved, and finally [we achieved Ruby3x3 last year](https://www.ruby-lang.org/en/news/2020/12/25/ruby-3-0-0-released/). But even though Optcarrot has shown impressive speedups, the JIT hasn't benefited real world business applications. + +Recently Shopify contributed many Ruby improvements to speed up their Rails application. YJIT is an important contribution, and aims to improve the performance of Rails applications. + +Though MJIT is a method-based JIT compiler and uses an external C compiler, YJIT uses Basic Block Versioning and includes JIT compiler inside it. With Lazy Basic Block Versioning (LBBV) it first compiles the beginning of a method, and incrementally compiles the rest when the type of arguments and variables are dynamically determined. See [YJIT: a basic block versioning JIT compiler for CRuby](https://dl.acm.org/doi/10.1145/3486606.3486781) for a detailed introduction. + +With this technology, YJIT achieves both fast warmup time and performance improvements on most real-world software, up to 22% on railsbench, 39% on liquid-render. + +YJIT is still an experimental feature, and as such, it is disabled by default. If you want to use this, specify the `--yjit` command-line option to enable YJIT. It is also limited to Unix-like x86-64 platforms for now. + +* https://bugs.ruby-lang.org/issues/18229 +* https://shopify.engineering/yjit-just-in-time-compiler-cruby +* https://www.youtube.com/watch?v=PBVLf3yfMs8 + +## debug gem: A new debugger + +A completely rewritten debugger [debug.gem](https://github.com/ruby/debug) is bundled. debug.gem has the following features: + +* Improve the debugging performance (it does not slow down the application even with the debugger) +* Support remote debugging +* Support rich debugging frontend (VSCode and Chrome browser are supported now) +* Support multi-process/multi-thread debugging +* Colorful REPL +* And other useful features like recod & replay feature, tracing feature and so on. + + + +Ruby had bundled lib/debug.rb, but it was not well maintained and it had issues about performance and features. debug.gem replaced lib/debug.rb completely. + +## error_highlight: Fine-grained error location in backtrace + +A built-in gem, error_highlight, has been introduced. It includes fine-grained error location in backtrace: + +``` +$ ruby test.rb +test.rb:1:in `
': undefined method `time' for 1:Integer (NoMethodError) + +1.time {} + ^^^^^ +Did you mean? times +``` + +Currently, only `NameError` is supported. + +This gem is enabled by default. You can disable it by using a command-line option `--disable-error_highlight`. See [the repository](https://github.com/ruby/error_highlight) in detail. + +## IRB Autocomplete and Document Display + +The IRB now has an autocomplete feature, where you can just type in the code, and the completion candidates dialog will appear. You can use Tab and Shift+Tab to move up and down. + +If documents are installed when you select a completion candidate, the documentation dialog will appear next to the completion candidates dialog, showing part of the content. You can read the full document by pressing Alt+d. + + + + +## Other Notable New Features + +### Language + +* Values in Hash literals and keyword arguments can be omitted. [Feature #14579] + * `{x:, y:}` is a syntax sugar of `{x: x, y: y}`. + * `foo(x:, y:)` is a syntax sugar of `foo(x: x, y: y)`. + +* Pin operator in pattern matching now takes an expression. [Feature #17411] + +```ruby +Prime.each_cons(2).lazy.find_all{_1 in [n, ^(n + 2)]}.take(3).to_a +#=> [[3, 5], [5, 7], [11, 13]] +``` + +* Parentheses can be omitted in one-line pattern matching. [Feature #16182] + +```ruby +[0, 1] => _, x +{y: 2} => y: +x #=> 1 +y #=> 2 +``` + +### RBS + +RBS is a language to describe the structure of Ruby programs. See [the repository](https://github.com/ruby/rbs) for details. + +Updates since Ruby 3.0.0: + +* Generic type parameters can be bounded. ([PR](https://github.com/ruby/rbs/pull/844)) +* Generic type aliases are supported. ([PR](https://github.com/ruby/rbs/pull/823)) +* `rbs collection` has been introduced to manage gems' RBSs. ([doc](https://github.com/ruby/rbs/blob/master/docs/collection.md)) +* Many signatures for built-in and standard libraries have been added/updated. +* It includes many bug fixes and performance improvements too. + +See [the CHANGELOG.md](https://github.com/ruby/rbs/blob/master/CHANGELOG.md) for more information. + +### TypeProf + +TypeProf is a static type analyzer for Ruby. It generates a prototype of RBS from non-type-annotated Ruby code. See [the document](https://github.com/ruby/typeprof/blob/master/doc/doc.md) for detail. + +The main updates since Ruby 3.0.0 is an experimental IDE support called "TypeProf for IDE". + +![Demo of TypeProf for IDE](https://cache.ruby-lang.org/pub/media/ruby310_typeprof_ide_demo.png) + +The vscode extension shows a guessed (or explicitly written in a RBS file) method signature above each method definition, draws a red underline under the code that may cause a name error or type error, and completes method names (i.e., shows method candidates). See [the document](https://github.com/ruby/typeprof/blob/master/doc/ide.md) in detail. + +Also, the release includes many bug fixes and performance improvements. + +## Performance improvements + +* MJIT + * For workloads like Rails, the default `--jit-max-cache` is changed from 100 to 10000. + The JIT compiler no longer skips compilation of methods longer than 1000 instructions. + * To support Zeitwerk of Rails, JIT-ed code is no longer cancelled + when a TracePoint for class events is enabled. + +## Other notable changes since 3.0 + +* One-line pattern matching, e.g., `ary => [x, y, z]`, is no longer experimental. +* Multiple assignment evaluation order has been changed slightly. [[Bug #4443]](https://bugs.ruby-lang.org/issues/4443) + * `foo[0], bar[0] = baz, qux` was evaluated in order `baz`, `qux`, `foo`, and then `bar` in Ruby 3.0. In Ruby 3.1, it is evaluated in order `foo`, `bar`, `baz`, and then `qux`. +* Variable Width Allocation: Strings (experimental) [[Bug #18239]](https://bugs.ruby-lang.org/issues/18239) + +* Psych 4.0 changes `Psych.load` as `safe_load` by the default. + You may need to use Psych 3.3.2 for migrating to this behavior. + [[Bug #17866]](https://bugs.ruby-lang.org/issues/17866) + +### Standard libraries updates + +* The following default gem are updated. + * RubyGems 3.3.3 + * base64 0.1.1 + * benchmark 0.2.0 + * bigdecimal 3.1.1 + * bundler 2.3.3 + * cgi 0.3.1 + * csv 3.2.2 + * date 3.2.2 + * did_you_mean 1.6.1 + * digest 3.1.0 + * drb 2.1.0 + * erb 2.2.3 + * error_highlight 0.3.0 + * etc 1.3.0 + * fcntl 1.0.1 + * fiddle 1.1.0 + * fileutils 1.6.0 + * find 0.1.1 + * io-console 0.5.9 + * io-wait 0.2.1 + * ipaddr 1.2.3 + * irb 1.4.1 + * json 2.6.1 + * logger 1.5.0 + * net-http 0.2.0 + * net-protocol 0.1.2 + * nkf 0.1.1 + * open-uri 0.2.0 + * openssl 3.0.0 + * optparse 0.2.0 + * ostruct 0.5.2 + * pathname 0.2.0 + * pp 0.3.0 + * prettyprint 0.1.1 + * psych 4.0.3 + * racc 1.6.0 + * rdoc 6.4.0 + * readline 0.0.3 + * readline-ext 0.1.4 + * reline 0.3.0 + * resolv 0.2.1 + * rinda 0.1.1 + * ruby2_keywords 0.0.5 + * securerandom 0.1.1 + * set 1.0.2 + * stringio 3.0.1 + * strscan 3.0.1 + * tempfile 0.1.2 + * time 0.2.0 + * timeout 0.2.0 + * tmpdir 0.1.2 + * un 0.2.0 + * uri 0.11.0 + * yaml 0.2.0 + * zlib 2.1.1 +* The following bundled gems are updated. + * minitest 5.15.0 + * power_assert 2.0.1 + * rake 13.0.6 + * test-unit 3.5.3 + * rexml 3.2.5 + * rbs 2.0.0 + * typeprof 0.21.1 +* The following default gems are now bundled gems. You need to add the following libraries to `Gemfile` under the bundler environment. + * net-ftp 0.1.3 + * net-imap 0.2.2 + * net-pop 0.1.1 + * net-smtp 0.3.1 + * matrix 0.4.2 + * prime 0.1.2 + * debug 1.4.0 + +See [NEWS](https://github.com/ruby/ruby/blob/{{ release.tag }}/NEWS.md) +or [commit logs](https://github.com/ruby/ruby/compare/v3_0_0...{{ release.tag }}) +for more details. + +With those changes, [{{ release.stats.files_changed }} files changed, {{ release.stats.insertions }} insertions(+), {{ release.stats.deletions }} deletions(-)](https://github.com/ruby/ruby/compare/v3_0_0...{{ release.tag }}#file_bucket) +since Ruby 3.0.0! + +Merry Christmas, Happy Holidays, and enjoy programming with Ruby 3.1! + +## Download + +* <{{ release.url.gz }}> + + SIZE: {{ release.size.gz }} + SHA1: {{ release.sha1.gz }} + SHA256: {{ release.sha256.gz }} + SHA512: {{ release.sha512.gz }} + +* <{{ release.url.xz }}> + + SIZE: {{ release.size.xz }} + SHA1: {{ release.sha1.xz }} + SHA256: {{ release.sha256.xz }} + SHA512: {{ release.sha512.xz }} + +* <{{ release.url.zip }}> + + SIZE: {{ release.size.zip }} + SHA1: {{ release.sha1.zip }} + SHA256: {{ release.sha256.zip }} + SHA512: {{ release.sha512.zip }} + +## What is Ruby + +Ruby was first developed by Matz (Yukihiro Matsumoto) in 1993, +and is now developed as Open Source. It runs on multiple platforms +and is used all over the world especially for web development. diff --git a/ja/news/_posts/2021-12-25-ruby-3-1-0-released.md b/ja/news/_posts/2021-12-25-ruby-3-1-0-released.md new file mode 100644 index 0000000000..b8f5a29bfa --- /dev/null +++ b/ja/news/_posts/2021-12-25-ruby-3-1-0-released.md @@ -0,0 +1,256 @@ +--- +layout: news_post +title: "Ruby 3.1.0 リリース" +author: "naruse" +translator: +date: 2021-12-25 00:00:00 +0000 +lang: ja +--- + +Ruby 3.1系初のリリースである、Ruby 3.1.0 が公開されました。 + +{% assign release = site.data.releases | where: "version", "3.1.0" | first %} + + +## YJIT: New experimental in-process JIT compiler + +Ruby 3.1では、Shopifyが開発した新しいプロセス内JITコンパイラであるYJITをマージしました。 + +[2018年のRuby 2.6でMJITをマージ](https://www.ruby-lang.org/ja/news/2018/12/25/ruby-2-6-0-released/)して以来、そのパフォーマンスは年々改善され、去年には[Ruby3x3を無事達成](https://www.ruby-lang.org/ja/news/2020/12/25/ruby-3-0-0-released/)しました。比較的大規模なOptcarrotベンチマークでは輝かしい高速化を達成したMJITですが、一方で現実の業務アプリケーションの性能はこれまで改善出来ていませんでした。 + +近年Shopifyは彼らのRailsアプリケーションを高速化するため、Rubyに対して多くの貢献をしてきました。YJITはその中でも重要な貢献であり、Railsアプリケーションをさらに高速化するために開発されました。 + +MJITがメソッドベースのJITコンパイラであり、外部のCコンパイラを利用しているのに対し、YJITではBasic Block Versioningという技術を用いた独自のJITコンパイラをRuby内部に持っています。YJITの用いているLazy Basic Block Versioning (LBBC)では、まずメソッドの冒頭のみをコンパイルし、実行時に実際に値が渡されて引数や変数の値が明らかになってから残りをコンパイルするという手法を用いることで、動的プログラミング言語においても効率のよいJITを実現しています。詳細は [YJIT: a basic block versioning JIT compiler for CRuby](https://dl.acm.org/doi/10.1145/3486606.3486781) を参照ください。 + +これらの技術によって、YJITでは素早い起動と高速な実行を多くの実世界のアプリケーションに対して実現しており、railsbenchでは最大22%、liquied-renderでは39%の高速化を達成しています。 + +YJITはまだ実験的機能なため、デフォルトでは無効化されています。試してみたい場合には `--yjit` コマンドラインオプションを指定することでYJITを有効化出来ます。現在YJITはx86-64上のUnix系プラットフォームでのみ実行出来ます。 + +* https://bugs.ruby-lang.org/issues/18229 +* https://shopify.engineering/yjit-just-in-time-compiler-cruby +* https://www.youtube.com/watch?v=PBVLf3yfMs8 + +## debug gem: 新しいデバッガ + +完全に0から書き直したデバッガである [debug.gem](https://github.com/ruby/debug) が同梱されました。次のような特徴があります。 + +* デバッグ時の速度低下を極力生じないよう改善 +* リモートデバッグのサポート +* リッチなデバッガフロントエンドに対応(現在 VSCode と Chrome ブラウザに対応) +* マルチプロセス、マルチスレッドプログラムのデバッグに対応 +* カラフルな REPL +* そのほか、Record & Replay 機能やトレース機能など、様々な便利機能 + + + +Rubyにはこれまでも lib/debug.rb が同梱されていましたが、あまりメンテナンスされておらず、性能や機能に問題がありました。debug.gem はこれを完全に置き換えます。 + +## error_highlight: バックトレース中の詳細なエラー位置表示 + +error_highlightという組み込みgemが導入されました。これにより、バックトレース中でエラーが発生した詳細な位置が表示されます。 + +``` +$ ruby test.rb +test.rb:1:in `
': undefined method `time' for 1:Integer (NoMethodError) + +1.time {} + ^^^^^ +Did you mean? times +``` + +現在のところ、位置が表示されるのは`NameError`のみです。 + +このgemはデフォルトで有効になっています。`--disable-error_highlight`コマンドラインオプションを指定することで無効化できます。詳しくは[ruby/error_highlightリポジトリ](https://github.com/ruby/error_highlight)を見てください。 + +## IRB のオートコンプリートとドキュメント表示 + +IRB にオートコンプリート機能が実装され、コードを入力するだけで補完候補ダイアログが表示されるようになりました。Tab と Shift+Tab で上下に移動できます。 + +また、補完候補を選択している時に、ドキュメントがインストールされている場合、補完候補ダイアログの横にドキュメントダイアログが表示され、内容が一部表示されます。Alt+d を押すことでドキュメント全文を読むことができます。 + + + +## その他の主要な新機能 + +### 言語機能 + +* ハッシュリテラルやキーワード引数の値が省略可能になりました。 [Feature #14579] + * `{x:, y:}` は、`{x: x, y: y}` の糖衣構文です。 + * `foo(x:, y:)` は、`foo(x: x, y: y)` の糖衣構文です。 + +* パターンマッチ中のピン演算子に任意の式を書けるようになりました。 [Feature #17411] + +```ruby +Prime.each_cons(2).lazy.find_all{_1 in [n, ^(n + 2)]}.take(3).to_a +#=> [[3, 5], [5, 7], [11, 13]] +``` + +* 一行パターンマッチで括弧が省略できるようになりました. [Feature #16182] + +```ruby +[0, 1] => _, x +{y: 2} => y: +x #=> 1 +y #=> 2 +``` + + +### RBS + +[RBS](https://github.com/ruby/rbs)はRubyプログラムの型を定義するための言語です。 + +3.0.0からは、次の様なアップデートがありました。 + +* ジェネリクスの型パラメータに制約を与えることができるようになりました。 ([PR](https://github.com/ruby/rbs/pull/844)) +* ジェネリックな型エイリアスが定義できようになりました。 ([PR](https://github.com/ruby/rbs/pull/823)) +* gemのRBSを管理するための`rbs collection`コマンドが導入されました。 ([doc](https://github.com/ruby/rbs/blob/master/docs/collection.md)) +* いろいろな組み込みクラスの型定義が追加、更新されました。 +* 多数のバグ修正と性能の改善が含まれています。 + +詳しくは[CHANGELOG.md](https://github.com/ruby/rbs/blob/master/CHANGELOG.md)を確認してください。 + +### TypeProf + +TypeProfはRubyの静的型解析器です。型注釈のないRubyコードから、RBSのプロトタイプを生成します。詳しくは[ドキュメント](https://github.com/ruby/typeprof/blob/master/doc/doc.md)をご参照ください. + +Ruby 3.0.0からの主なアップデートは、"TypeProf for IDE"という実験的なIDEサポートです。 + +![Demo of TypeProf for IDE](https://cache.ruby-lang.org/pub/media/ruby310_typeprof_ide_demo.png) + +このVSCode拡張は、推定された(またはRBSファイルに手で明記された)メソッドのシグネチャを、各メソッド定義の上に表示します。 +また、NameErrorやTypeErrorを起こしうるコードを赤い下線で示します。 +さらに、メソッド名の補完(メソッド名の候補の表示)を行います。 +詳しくは[ドキュメント](https://github.com/ruby/typeprof/blob/master/doc/ide.md)をご参照ください。 + +また、数多くのバグ修正やパフォーマンス向上がなされています。 + +## パフォーマンスの改善 + +* MJIT + * For workloads like Rails, the default `--jit-max-cache` is changed from 100 to 10000. + The JIT compiler no longer skips compilation of methods longer than 1000 instructions. + * To support Zeitwerk of Rails, JIT-ed code is no longer cancelled + when a TracePoint for class events is enabled. + + +## その他の注目すべき 3.0 からの変更点 + +* 一行パターンマッチ(たとえば `ary => [x, y, z]`)が実験的機能ではなくなりました。 + +* 多重代入の評価順序が若干変更されました。[[Bug #4443]](https://bugs.ruby-lang.org/issues/4443) + * `foo[0], bar[0] = baz, qux` は、Ruby 3.0 では `baz`, `qux`, `foo`, `bar` という順序で評価されていましたが、Ruby 3.1 では `foo`, `bar`, `baz`, `qux` の順で表kされます。 + +* 可変幅アロケーション(Variable Width Allocation)が実装されました。現在は試験的にStringが対応しています。 [[Bug #18239]](https://bugs.ruby-lang.org/issues/18239) + +* Psych 4.0 では `Psych.load` が `safe_load` を利用するように変更されました。この挙動が影響ある場合は、従来の挙動である `unsafe_load` を利用する Psych 3.3.2 を移行パスとして利用できます。[[Bug #17866]](https://bugs.ruby-lang.org/issues/17866) + +## 標準添付ライブラリのアップデート + +* 以下の default gems のバージョンがアップデートされました。 + * RubyGems 3.3.3 + * base64 0.1.1 + * benchmark 0.2.0 + * bigdecimal 3.1.1 + * bundler 2.3.3 + * cgi 0.3.1 + * csv 3.2.2 + * date 3.2.2 + * did_you_mean 1.6.1 + * digest 3.1.0 + * drb 2.1.0 + * erb 2.2.3 + * error_highlight 0.3.0 + * etc 1.3.0 + * fcntl 1.0.1 + * fiddle 1.1.0 + * fileutils 1.6.0 + * find 0.1.1 + * io-console 0.5.9 + * io-wait 0.2.1 + * ipaddr 1.2.3 + * irb 1.4.1 + * json 2.6.1 + * logger 1.5.0 + * net-http 0.2.0 + * net-protocol 0.1.2 + * nkf 0.1.1 + * open-uri 0.2.0 + * openssl 3.0.0 + * optparse 0.2.0 + * ostruct 0.5.2 + * pathname 0.2.0 + * pp 0.3.0 + * prettyprint 0.1.1 + * psych 4.0.3 + * racc 1.6.0 + * rdoc 6.4.0 + * readline 0.0.3 + * readline-ext 0.1.4 + * reline 0.3.0 + * resolv 0.2.1 + * rinda 0.1.1 + * ruby2_keywords 0.0.5 + * securerandom 0.1.1 + * set 1.0.2 + * stringio 3.0.1 + * strscan 3.0.1 + * tempfile 0.1.2 + * time 0.2.0 + * timeout 0.2.0 + * tmpdir 0.1.2 + * un 0.2.0 + * uri 0.11.0 + * yaml 0.2.0 + * zlib 2.1.1 +* 以下の bundled gems のバージョンがアップデートされました。 + * minitest 5.15.0 + * power_assert 2.0.1 + * rake 13.0.6 + * test-unit 3.5.3 + * rexml 3.2.5 + * rbs 2.0.0 + * typeprof 0.21.1 +* 以下のライブラリが新たに bundled gems になりました。Bundler から利用する場合は Gemfile に明示的に指定してください。 + * net-ftp 0.1.3 + * net-imap 0.2.2 + * net-pop 0.1.1 + * net-smtp 0.3.1 + * matrix 0.4.2 + * prime 0.1.2 + * debug 1.4.0 + + +その他詳細については、[NEWS](https://github.com/ruby/ruby/blob/{{ release.tag }}/NEWS.md) ファイルまたは[コミットログ](https://github.com/ruby/ruby/compare/v3_0_0...{{ release.tag }})を参照してください。 + +なお、こうした変更により、Ruby 3.0.0 以降では [{{ release.stats.files_changed }} 個のファイルに変更が加えられ、{{ release.stats.insertions }} 行の追加と {{ release.stats.deletions }} 行の削除が行われました](https://github.com/ruby/ruby/compare/v3_0_0...{{ release.tag }}#file_bucket) ! + +メリークリスマス、様々な機能が追加された Ruby 3.1 をぜひお楽しみ下さい! + +## ダウンロード + +* <{{ release.url.gz }}> + + SIZE: {{ release.size.gz }} + SHA1: {{ release.sha1.gz }} + SHA256: {{ release.sha256.gz }} + SHA512: {{ release.sha512.gz }} + +* <{{ release.url.xz }}> + + SIZE: {{ release.size.xz }} + SHA1: {{ release.sha1.xz }} + SHA256: {{ release.sha256.xz }} + SHA512: {{ release.sha512.xz }} + +* <{{ release.url.zip }}> + + SIZE: {{ release.size.zip }} + SHA1: {{ release.sha1.zip }} + SHA256: {{ release.sha256.zip }} + SHA512: {{ release.sha512.zip }} + +## Ruby とは + +Rubyはまつもとゆきひろ (Matz) によって1993年に開発が始められ、今もオープンソースソフトウェアとして開発が続けられています。Rubyは様々なプラットフォームで動き、世界中で、特にWebアプリケーション開発のために使われています。 From 9d266cfb613f62b4adb37cf857aca5e93a96171b Mon Sep 17 00:00:00 2001 From: "NARUSE, Yui" Date: Sat, 25 Dec 2021 20:41:25 +0900 Subject: [PATCH 0117/1090] Ruby 3 1 0 released 2 (#2766) * fix videos * Add stats to _data/releases.yml --- _data/releases.yml | 5 +++++ en/news/_posts/2021-12-25-ruby-3-1-0-released.md | 5 ++--- ja/news/_posts/2021-12-25-ruby-3-1-0-released.md | 4 +++- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/_data/releases.yml b/_data/releases.yml index a7a6341109..d84d0c9226 100644 --- a/_data/releases.yml +++ b/_data/releases.yml @@ -24,6 +24,11 @@ - version: 3.1.0 date: 2021-12-25 post: /en/news/2021/12/25/ruby-3-1-0-released/ + tag: ruby_3_1_0 + stats: + files_changed: 3123 + insertions: 551754 + deletions: 99153 url: gz: https://cache.ruby-lang.org/pub/ruby/3.1/ruby-3.1.0.tar.gz zip: https://cache.ruby-lang.org/pub/ruby/3.1/ruby-3.1.0.zip diff --git a/en/news/_posts/2021-12-25-ruby-3-1-0-released.md b/en/news/_posts/2021-12-25-ruby-3-1-0-released.md index caf363cc42..9e80c9e092 100644 --- a/en/news/_posts/2021-12-25-ruby-3-1-0-released.md +++ b/en/news/_posts/2021-12-25-ruby-3-1-0-released.md @@ -71,11 +71,10 @@ The IRB now has an autocomplete feature, where you can just type in the code, an If documents are installed when you select a completion candidate, the documentation dialog will appear next to the completion candidates dialog, showing part of the content. You can read the full document by pressing Alt+d. -