-
Notifications
You must be signed in to change notification settings - Fork 330
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
deconstruct と deconstruct keys についての説明を追加 #2894
Merged
ohai
merged 11 commits into
rurema:master
from
sanfrecce-osaka:add-deconstruct-and-deconstruct-keys
Jul 22, 2024
Merged
deconstruct と deconstruct keys についての説明を追加 #2894
ohai
merged 11 commits into
rurema:master
from
sanfrecce-osaka:add-deconstruct-and-deconstruct-keys
Jul 22, 2024
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cf. https://docs.ruby-lang.org/en/3.3/Struct.html#method-i-deconstruct v2_7_0_preview3 での追加のためバージョンによる分岐は不要 cf. ruby/ruby@9c9db64
cf. https://docs.ruby-lang.org/en/3.3/Struct.html#method-i-deconstruct_keys v2_7_0_preview3 での追加のためバージョンによる分岐は不要 ruby/ruby@d4da74e
cf. https://docs.ruby-lang.org/en/3.3/MatchData.html#method-i-deconstruct 追加は v3_2_0_preview3 から cf. ruby/ruby@4954c9f
cf. https://docs.ruby-lang.org/en/3.3/MatchData.html#method-i-deconstruct 追加は v3_2_0_preview3 から cf. ruby/ruby@4954c9f
cf. https://docs.ruby-lang.org/en/3.3/CSV/Row.html#method-i-deconstruct rdoc にはサンプルコードがなかったためオリジナルのものを追加している 追加は csv v3.2.0 からでこのバージョンが標準添付されるようになったのは v3.1.0 から cf. ruby/csv@a01c8f2 cf. https://github.com/ruby/ruby/blob/v3_3_2/doc/NEWS/NEWS-3.1.0.md
cf. https://docs.ruby-lang.org/en/3.3/CSV/Row.html#method-i-deconstruct rdoc にはサンプルコードがなかったためオリジナルのものを追加している また ruby/csv#207 (comment) の挙動は記載しておくべきと考えたため説明を追加している 追加は csv v3.2.0 からでこのバージョンが標準添付されるようになったのは v3.1.0 から cf. ruby/csv@a01c8f2 cf. https://github.com/ruby/ruby/blob/v3_3_2/doc/NEWS/NEWS-3.1.0.md
…hing_non_primitive_objects へのリンクを追加
- hash: rdoc の記載のまま hash になっていたがるりまでは Hash とクラスで記載するのが正しい - cf. https://docs.ruby-lang.org/en/3.3/Data.html#method-i-deconstruct_keys - cf. https://github.com/rurema/doctree/wiki/HowToWriteMethodEntry#%E8%BF%94%E3%82%8A%E5%80%A4%E3%81%AE%E5%9E%8B%E3%81%AE%E8%A8%98%E8%BF%B0%E6%96%B9%E6%B3%95 - array: rdoc の記載のまま array になっていたがるりまでは任意のオブジェクトの配列を返す場合は [object] と記載するのが正しい - cf. https://docs.ruby-lang.org/en/3.3/Data.html#method-i-deconstruct_keys - cf. https://github.com/rurema/doctree/wiki/HowToWriteMethodEntry#%E8%BF%94%E3%82%8A%E5%80%A4%E3%81%AE%E5%9E%8B%E3%81%AE%E8%A8%98%E8%BF%B0%E6%96%B9%E6%B3%95
sanfrecce-osaka
commented
Jun 11, 2024
|
||
パターンマッチに使用するヘッダの名前と値の [[c:Hash]] を返します。 | ||
|
||
このメソッドはヘッダ名の型をシンボルに変換しないため、ヘッダ名が文字列かつ Hash パターン でパターンマッチしたい場合はキーをシンボルに変換する必要があります。 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ruby/csv#207 (comment) の挙動の説明です
PRありがとうございます。特に問題なさそうだったのでマージしました。 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
各クラスの deconstruct と deconstruct_keys の説明を追加しました
またパターンマッチのドキュメントを参照できるように @see で
非プリミティブなオブジェクトのマッチ: deconstruct メソッドと deconstruct_keys メソッド
へのリンクを全ての deconstruct・deconstruct_keys の説明に追加しました