This project is archived and is in readonly mode.
ActiveSupport::Duration is not properly delegating to its value
Reported by Godfrey Chan | August 30th, 2010 @ 03:09 PM
http://github.com/rails/rails/blob/master/activesupport/lib/active_...
Line 102 should probably be value.send(method, *args, &block)... In the current code anything which requires a block won't work properly. For instance, 1.day.times { puts 'Hello' } returns an Enumerator instead of doing what you expected. Now maybe it doesn't make sense to call times on a duration, but point being anything that requires a block won't work.
If this is for some odd reason the right behaviour it really should be documented in the code.
I'm in a hurry now so if someone could attach the tests and patches for this it'd be great. Otherwise I'll do it tonight.
Comments and changes to this ticket
-
Marjan Krekoten' August 30th, 2010 @ 08:57 PM
- Tag changed from delegate method, activesupport, duration, method_missing to delegate method, activesupport, duration, method_missing, patch
I've attached patch with fix suggested by Godfrey Chan and test for it.
-
Godfrey Chan August 31st, 2010 @ 04:36 PM
Test on my system (rvm 1.8.7 + 1.9.2), the test passed and the patch worked flawlessly.
-
Marjan Krekoten' September 1st, 2010 @ 07:00 AM
- Assigned user set to José Valim
-
Repository September 1st, 2010 @ 09:15 AM
- State changed from new to resolved
(from [2adad2a0cc6e6179cb03b6e2c61d7e8efd46389e]) Make ActiveSupport::Duration#method_missing delegate blocks to value [#5498 state:resolved]
Signed-off-by: José Valim jose.valim@gmail.com
http://github.com/rails/rails/commit/2adad2a0cc6e6179cb03b6e2c61d7e... -
Repository September 1st, 2010 @ 09:15 AM
(from [57693d1362dcde9e0e32689255a22414488e1335]) Make ActiveSupport::Duration#method_missing delegate blocks to value [#5498 state:resolved]
Signed-off-by: José Valim jose.valim@gmail.com
http://github.com/rails/rails/commit/57693d1362dcde9e0e32689255a224...
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
<h2 style="font-size: 14px">Tickets have moved to Github</h2>
The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>
People watching this ticket
Attachments
Referenced by
- 5498 ActiveSupport::Duration is not properly delegating to its value (from [2adad2a0cc6e6179cb03b6e2c61d7e8efd46389e]) Make Ac...
- 5498 ActiveSupport::Duration is not properly delegating to its value (from [57693d1362dcde9e0e32689255a22414488e1335]) Make Ac...