Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hash#shiftのハッシュが空かつデフォルト値が設定されている場合の説明とサンプルコードの実行結果が古かったのを修正 #2863

Merged
merged 3 commits into from
Jul 27, 2024

Conversation

maimux2x
Copy link
Contributor

Hash#shiftのハッシュが空かつデフォルト値が設定されている場合の説明とサンプルコードの実行結果がruby-3.3.0の内容になっていなかったため修正しました。

$ docker run -it --rm rubylang/all-ruby ./all-ruby -e 'h1 = Hash.new("default value"); p h1; p h1.shift'

...
ruby-1.4.6            {}
                      nil
ruby-1.6.0            {}
                      "default value"
...
ruby-3.1.4            {}
                      "default value"
ruby-3.2.0-preview1   {}
                      nil
...
ruby-3.3.0            {}
                      nil
$ docker run -it --rm rubylang/all-ruby ./all-ruby -e 'h2 = Hash.new {|*arg| arg}; p h2; p h2.shift'

...
ruby-1.6.8            {}
                      nil
ruby-1.8.0            {}
                      [{}, nil]
...
ruby-3.1.4            {}
                      [{}, nil]
ruby-3.2.0-preview1   {}
                      nil
...
ruby-3.3.0            {}
                      nil

Hash#shiftのハッシュが空かつデフォルト値が設定されている場合の説明とサンプルコードの実行結果がruby-3.3.0の内容になっていなかったため修正しました。

```
$ docker run -it --rm rubylang/all-ruby ./all-ruby -e 'h1 = Hash.new("default value"); p h1; p h1.shift'

...
ruby-1.4.6            {}
                      nil
ruby-1.6.0            {}
                      "default value"
...
ruby-3.1.4            {}
                      "default value"
ruby-3.2.0-preview1   {}
                      nil
...
ruby-3.3.0            {}
                      nil
```

```
$ docker run -it --rm rubylang/all-ruby ./all-ruby -e 'h2 = Hash.new {|*arg| arg}; p h2; p h2.shift'

...
ruby-1.6.8            {}
                      nil
ruby-1.8.0            {}
                      [{}, nil]
...
ruby-3.1.4            {}
                      [{}, nil]
ruby-3.2.0-preview1   {}
                      nil
...
ruby-3.3.0            {}
                      nil
```
Copy link
Member

@znz znz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

まだ Ruby 3.1 などにも対応している期間なので、バージョン分岐で 3.3 対応をお願いします。
https://github.com/rurema/doctree/blob/master/CONTRIBUTING.md#%E5%90%84%E3%83%90%E3%83%BC%E3%82%B8%E3%83%A7%E3%83%B3%E3%81%AE%E5%AF%BE%E5%BF%9C%E6%96%B9%E9%87%9D

@maimux2x
Copy link
Contributor Author

maimux2x commented Jun 2, 2024

3.2以前と以降で説明を分けました。
改めてご確認の程よろしくお願いいたします。

@ohai
Copy link
Member

ohai commented Jul 22, 2024

#@until を使って分岐するように変更しました

@ohai ohai merged commit 642f048 into rurema:master Jul 27, 2024
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants