[ruby-core:102167] [Ruby master Bug#17560] Does `Module#ruby2_keywords` return `nil` or `self`?
From:
eregontp@...
Date:
2021-01-19 16:03:48 UTC
List:
ruby-core #102167
Issue #17560 has been updated by Eregon (Benoit Daloze). Since ruby2_keywords is often used conditionally, I think there is little value for it to return Symbols: https://github.com/rails/rails/blob/291a3d2ef29a3842d1156ada7526f4ee60dd2b59/actionpack/lib/action_dispatch/middleware/stack.rb#L94 Also `private ruby2_keywords def foo` seems very long and hard to read. ---------------------------------------- Bug #17560: Does `Module#ruby2_keywords` return `nil` or `self`? https://bugs.ruby-lang.org/issues/17560#change-90017 * Author: nobu (Nobuyoshi Nakada) * Status: Assigned * Priority: Normal * Assignee: jeremyevans0 (Jeremy Evans) * Backport: 2.5: DONTNEED, 2.6: DONTNEED, 2.7: REQUIRED, 3.0: REQUIRED ---------------------------------------- The RDoc says that it returns `self`: ``` ruby2_keywords(method_name, ...) -> self ``` This seems consistent with other methods which accept method names, e.g., `public`, `private`, etc. But it actually returns `nil`, and `TestKeywordArguments#test_ruby2_keywords` also has 2 `assert_nil`s. Which is intentional? [patch to fix code as the doc](https://github.com/ruby/ruby/pull/4097) -- https://bugs.ruby-lang.org/ Unsubscribe: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe> <http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>