* [ruby-dev:48921] [Ruby trunk - Bug #11039] [Open] method_missing の *args 引数に symbol をキーにした hash だけを渡すと エラーとなる
[not found] <redmine.issue-11039.20150407091139@ruby-lang.org>
@ 2015-04-07 9:11 ` kiyono
2019-09-02 4:27 ` [ruby-dev:50844] [Ruby master Bug#11039] " merch-redmine
1 sibling, 0 replies; 2+ messages in thread
From: kiyono @ 2015-04-07 9:11 UTC (permalink / raw)
To: ruby-dev
Issue #11039 has been reported by yoshimitsu kiyono.
----------------------------------------
Bug #11039: method_missing の *args 引数に symbol をキーにした hash だけを渡すと エラーとなる
https://bugs.ruby-lang.org/issues/11039
* Author: yoshimitsu kiyono
* Status: Open
* Priority: Normal
* Assignee:
* ruby -v: ruby 2.2.1p85 (2015-02-26 revision 49769) [x86_64-darwin13]
* Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN
----------------------------------------
method_missing に 第3引数として キーワード引数を設定した上で、引数に symbol をキーにした Hash だけを渡すと
=> unknown keyword: a (ArgumentError)
となる。
※ 第3引数を付け足さなければエラーにならない。
引数が文字列をキーにした Hash であればエラーにならないため、キーが symbol でも Hash であるならば合わせた挙動であるべきではないでしょうか。
---Files--------------------------------
foo.rb (244 Bytes)
--
https://bugs.ruby-lang.org/
^ permalink raw reply [flat|nested] 2+ messages in thread
* [ruby-dev:50844] [Ruby master Bug#11039] method_missing の *args 引数に symbol をキーにした hash だけを渡すと エラーとなる
[not found] <redmine.issue-11039.20150407091139@ruby-lang.org>
2015-04-07 9:11 ` [ruby-dev:48921] [Ruby trunk - Bug #11039] [Open] method_missing の *args 引数に symbol をキーにした hash だけを渡すと エラーとなる kiyono
@ 2019-09-02 4:27 ` merch-redmine
1 sibling, 0 replies; 2+ messages in thread
From: merch-redmine @ 2019-09-02 4:27 UTC (permalink / raw)
To: ruby-dev
Issue #11039 has been updated by jeremyevans0 (Jeremy Evans).
Status changed from Open to Closed
With the acceptance of #14183, you now get a warning as the behavior will change in Ruby 3:
```ruby
Foo.bar({ b: 1 })
# (irb):67: warning: The last argument is used as the keyword parameter
# (irb):58: warning: for `method_missing' defined here
# ArgumentError (unknown keyword: :b)
```
In Ruby 3, you will not get a warning, and the hash will be passed as a positional argument. To get the Ruby 3 behavior with the master branch:
```ruby
Foo.bar({ b: 1 }, **(;{}))
# => [{:b=>1}]
```
----------------------------------------
Bug #11039: method_missing の *args 引数に symbol をキーにした hash だけを渡すと エラーとなる
https://bugs.ruby-lang.org/issues/11039#change-81325
* Author: kiyono (yoshimitsu kiyono)
* Status: Closed
* Priority: Normal
* Assignee:
* Target version:
* ruby -v: ruby 2.2.1p85 (2015-02-26 revision 49769) [x86_64-darwin13]
* Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN
----------------------------------------
method_missing に 第3引数として キーワード引数を設定した上で、引数に symbol をキーにした Hash だけを渡すと
=> unknown keyword: a (ArgumentError)
となる。
※ 第3引数を付け足さなければエラーにならない。
引数が文字列をキーにした Hash であればエラーにならないため、キーが symbol でも Hash であるならば合わせた挙動であるべきではないでしょうか。
---Files--------------------------------
foo.rb (244 Bytes)
--
https://bugs.ruby-lang.org/
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-09-02 4:27 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <redmine.issue-11039.20150407091139@ruby-lang.org>
2015-04-07 9:11 ` [ruby-dev:48921] [Ruby trunk - Bug #11039] [Open] method_missing の *args 引数に symbol をキーにした hash だけを渡すと エラーとなる kiyono
2019-09-02 4:27 ` [ruby-dev:50844] [Ruby master Bug#11039] " merch-redmine
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).