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

deconstruct と deconstruct keys についての説明を追加 #2894

Merged

Conversation

sanfrecce-osaka
Copy link
Contributor

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/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 へのリンクを追加

パターンマッチに使用するヘッダの名前と値の [[c:Hash]] を返します。

このメソッドはヘッダ名の型をシンボルに変換しないため、ヘッダ名が文字列かつ Hash パターン でパターンマッチしたい場合はキーをシンボルに変換する必要があります。
Copy link
Contributor Author

Choose a reason for hiding this comment

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

ruby/csv#207 (comment) の挙動の説明です

@ohai ohai merged commit 4f5c0d9 into rurema:master Jul 22, 2024
8 checks passed
@ohai
Copy link
Member

ohai commented Jul 22, 2024

PRありがとうございます。特に問題なさそうだったのでマージしました。

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.

2 participants