jonathanhefner (Jonathan Hefner)
- Login: jonathanhefner
- Email: jonathan@hefner.pro, jonathan.hefner@gmail.com
- Registered on: 04/30/2019
- Last sign in: 10/13/2023
Issues
| open | closed | Total | |
|---|---|---|---|
| Assigned issues | 0 | 0 | 0 |
| Reported issues | 1 | 3 | 4 |
Activity
12/01/2022
-
05:19 PM Ruby Bug #19079: Modules included in a DelegateClass cannot override delegate methods
- This issue occurred for a private module in Rails: https://github.com/rails/rails/pull/46189#discussion_r991440668.
Using `include` in a subclass works. Using `prepend` also works, and is the workaround I used for the Rails module.
...
10/23/2022
-
03:02 AM Ruby Bug #19079: Modules included in a DelegateClass cannot override delegate methods
- I have submitted a PR with the proposed solution: https://github.com/ruby/delegate/pull/14.
-
03:01 AM Ruby Bug #19079 (Rejected): Modules included in a DelegateClass cannot override delegate methods
- Because `DelegateClass` defines delegate methods on the class itself, those delegate methods come first in the method lookup chain. This prevents included modules from overriding delegate methods:
```ruby
Base = Class.new do
...
10/14/2022
-
03:08 PM Ruby Revision 60610031 (git): [ruby/delegate] Fix DelegateClass block "method redefined" warning
- This commit prevents "method redefined" warnings when overriding methods
within a `DelegateClass` block, such as in the following example:
```ruby
Base = Class.new do
def foo
"foo"
end
end
Overridden = DelegateCla...
10/13/2022
-
04:36 PM Ruby Bug #19047: DelegateClass displays "method redefined" warning when overriding methods
- > Thank you, now the issue is that `delegate` doesn't have a maintainer: https://github.com/ruby/ruby/commit/1159dbf305603b60a1e5d2b9ff77a9cf30775296
What is involved in being a maintainer? Is that something I can volunteer for?
10/11/2022
-
09:41 PM Ruby Bug #19047: DelegateClass displays "method redefined" warning when overriding methods
- Submitted `alias_method` patch as https://github.com/ruby/delegate/pull/13.
-
08:50 PM Ruby Bug #19047: DelegateClass displays "method redefined" warning when overriding methods
- > The main reason to prefer `alias_method` is that it's the least amount of changes, so least likely to break anything.
That's a good reason! 😄
There is one more use case that would be affected:
```ruby
Base = Class.new do
d... -
06:09 PM Ruby Bug #19047: DelegateClass displays "method redefined" warning when overriding methods
- Indeed, `alias_method` is another possibility! And also [Jean's suggestion](https://github.com/rails/rails/pull/46189#discussion_r988685084) of defining the delegator methods in a module.
Unfortunately, my suggestion of evaluating th...
10/10/2022
-
07:30 PM Ruby Bug #19047 (Closed): DelegateClass displays "method redefined" warning when overriding methods
- Perhaps this is not a bug, but it does seem unexpected.
When creating a `DelegateClass` class without an intervening ancestor, overriding a method displays "method redefined" warning:
```ruby
Base = Class.new do
def foo
"f...
12/07/2020
-
06:41 PM Ruby Misc #17346: DevelopersMeeting20201210Japan
- * [Bug #15661] Disallow concurrent Dir.chdir with block (jonathanhefner)
* This change is causing some issues in Rails (e.g. https://github.com/rails/rails/commit/ae5ecfe26c8 and https://github.com/rails/rails/issues/40756).
* I ha...