My favorites | Sign in
Project Home Downloads Wiki Issues Source
READ-ONLY: This project has been archived. For more information see this post.
Search
for
  Advanced search   Search tips   Subscriptions
Issue 11: Substruct should have an easy way to deprecate methods.
1 person starred this issue and may be notified of changes. Back to list
Status:  fixed
Owner:  subim...@gmail.com
Closed:  Apr 2008


 
Reported by edmundo...@gmail.com, Feb 12, 2008
Here goes some methods to help to deprecate things. (I borrowed from typo:
http://typosphere.org/)

Its very simple and will let make things like that:

#Defined to save tags from product edit view
def tags=(list)
  substruct_deprecated "Use tag_ids= instead."
  tags.clear
  for id in list
    tags << Tag.find(id) if !id.empty?
  end
end

# Defined to save tags from product edit view
def tag_ids=(list)
  tags.clear
  for id in list
    tags << Tag.find(id) if !id.empty?
  end
end


Or even better:

substruct_deprecate :tags= => :tag_ids=

# Defined to save tags from product edit view
def tag_ids=(list)
  tags.clear
  for id in list
    tags << Tag.find(id) if !id.empty?
  end
end

And the old method will be auto-generated with a warning at the beginning
and pointing to the new one.

Very clever.

It can be put at /lib in plugins and should be required wherever you think
is better.

Regards.
substruct_deprecated.rb
838 bytes   View   Download
Apr 8, 2008
Project Member #1 subim...@gmail.com
(No comment was entered for this change.)
Status: Accepted
Labels: -Priority-Medium Priority-Low
Apr 9, 2008
Project Member #2 subim...@gmail.com
Added into /vendor/plugins/substruct/lib in revision 73.

Please propose a patch for including and deprecating methods so I can see it in use.
Apr 9, 2008
#3 edmundo...@gmail.com
I already did, its the next one,  issue 12 
Apr 9, 2008
Project Member #4 subim...@gmail.com
Yep just saw that...thanks, included and closed. Fixed up some tests as well.
Apr 9, 2008
#5 edmundo...@gmail.com
If the  issue 12  was fixed, this one must be fixed too as one depends on the other.
I updated my working copy and I saw that this one is already there, just close it. 
Apr 9, 2008
Project Member #6 subim...@gmail.com
Sorry guess I forgot to close this one :)
Status: fixed
Owner: subimage

Powered by Google Project Hosting