This project is archived and is in readonly mode.
deprecate fails on methods ending with equal sign
Reported by Michael Siebert | April 6th, 2009 @ 07:03 PM | in 2.x
it is not possible to deprecate methods that end with "=" using ActiveSupport::Deprecation.
class Foo
attr_accessor bar
deprecate :bar=
end
this throws the following error:
active_support/deprecation.rb:100:in `deprecate': compile error (SyntaxError)
activesupport/lib/active_support/deprecation.rb:99: syntax error, unexpected ',', expecting '='
this is because Foo.foo=(*bar)
is not valid ruby
syntax. The fix is to use send instead.
Comments and changes to this ticket
-
Levin Alexander April 6th, 2009 @ 07:26 PM
attached is an updated patch that adds
assert_deprecated { @dtc.f = :foo }
to the tests -
Levin Alexander April 6th, 2009 @ 07:27 PM
attached is an updated patch that adds
assert_deprecated { @dtc.f = :foo }
to the tests -
Levin Alexander June 25th, 2009 @ 12:05 AM
- Tag changed from active_support, patch to 2.x, 3.0, active_support, patch, small
-
CancelProfileIsBroken August 7th, 2009 @ 02:13 PM
- Tag changed from 2.x, 3.0, active_support, patch, small to 2.x, 3.0, active_support, bugmash, patch, small
-
Michael Siebert August 7th, 2009 @ 02:41 PM
+1
for levin's patch for 2-3-stable, applies clean and works. we're currently using this patch in production for our own app, so i consider it production-ready
-
Michael Siebert August 7th, 2009 @ 02:47 PM
+1 for the 2nd patch (for master), too, verified that it works
-
Matt Duncan August 8th, 2009 @ 04:49 AM
+1 for both patches (2-3-stable and master), verified that both are passing tests and working as expected.
-
Dan Pickett August 8th, 2009 @ 11:31 PM
verified
-1 however - a symbol cannot end in equal sign - the deprecate call should really be proper syntax -
deprecate "bar="
-
Dan Pickett August 8th, 2009 @ 11:40 PM
sorry - Josevalim corrected me symbols with = at the end are valid > 1.8.6
-
Levin Alexander August 8th, 2009 @ 11:57 PM
seems they are also valid in ruby 1.8.6:
system:~$ ruby --version ruby 1.8.6 (2007-06-07 patchlevel 36) [x86_64-linux] system:~$ ruby -e "p :foo=" :foo=
-
Nick Quaranto August 9th, 2009 @ 12:08 AM
+1, both patches look fine to me and activesupport's tests are passing.
-
Rizwan Reza August 9th, 2009 @ 02:39 AM
- Tag changed from 2.x, 3.0, active_support, bugmash, patch, small to 2.x, 3.0, active_support, bugmash, patch, small, verified
verified
+1 The patches work fine.
-
José Valim August 9th, 2009 @ 03:59 PM
- State changed from new to resolved
- Tag changed from 2.x, 3.0, active_support, bugmash, patch, small, verified to 2.x, 3.0, active_support, patch, small, verified
-
Repository August 9th, 2009 @ 04:04 PM
(from [d811864e880580549bc1ab73a1ab0be886598e6e]) Fix deprecating =-methods by using send [#2431 status:resolved]
Signed-off-by: José Valim jose.valim@gmail.com
http://github.com/rails/rails/commit/d811864e880580549bc1ab73a1ab0b... -
Repository August 9th, 2009 @ 04:13 PM
(from [4c96030d05b877919dfe2613290826beee464240]) Fix deprecating =-methods by using send [#2431 status:resolved]
Signed-off-by: José Valim jose.valim@gmail.com
http://github.com/rails/rails/commit/4c96030d05b877919dfe2613290826...
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
- 2431 deprecate fails on methods ending with equal sign (from [d811864e880580549bc1ab73a1ab0be886598e6e]) Fix dep...
- 2431 deprecate fails on methods ending with equal sign (from [4c96030d05b877919dfe2613290826beee464240]) Fix dep...