Currently ActiveSupport::Deprecation is a global that can be only used by Rails due to its generated messages. However it is a very nicely written piece of software that could be used by Rails applications (you know some of them last for years and it would be nice for them to have the ability to deprecate their own api) or gems that already depend on rails or active_support. This patch aims at fixing it.
It let's you use ActiveSupport::Deprecation as a module and include it in a class.
And it also adds additional argument to ActiveSupport::Deprecation::DeprecatedInstanceVariableProxy and ActiveSupport::Deprecation::DeprecatedConstantProxy constructors so that warnings can be generated by other objects than ActiveSupport::Deprecation module itself (but that's the default).
I added few more tests to make sure that those features works as advertised.
extend ActiveSupport::Deprecation with self, allow other objects to e…
…xtend/include it also.
test local deprecation
Test ActiveSupport::Deprecation when included
I agree with the feature but wouldn't the implementation be better if AS::Deprecation actually became a class? Then we could simply delegate the most use methods like warn, deprecate and so on to an specific instance.
@paneq Is this still an issue?
It never was an issue, it was a feature. I think we can close.
I think this feature is actually welcome and a nice refactoring. /cc @tenderlove @jeremy wdyt?
@paneq This can't be merged anymore, and @josevalim and @jeremey said they like the feature, but want a different implementation... are you interested in creating that implementation? If not, let me know and I'll give it a shot.
I would love to but I am getting married, buying new house and going to hospital in this month so I am kind of busy :) and I won't be able to take it on me.
No worries. I'll check it out myself within a few days.
Congrats on the marriage, I hope the hospital isn't too bad.
@carlosantoniodasilva @rafaelfranca If there is an updated version of this, can we close it?
Yeah, the other one currently has a lot more reviews and is likely to be merged in the near future. Thanks!