From: Lazaridis Ilias Date: 2011-07-13T08:32:21+09:00 Subject: [ruby-core:38033] [Ruby 1.9 - Feature #5005] Provide convenient access to original methods Issue #5005 has been updated by Lazaridis Ilias. Lazaridis Ilias wrote: > The languag allows a class to be "reopened", thus it's behaviour can be redefined: [...] > "original" would behave similar to "super" > > The term "original" can be replaced by any term which describes this concept better. Just realized that "previous" would be a more concise term. * super : the super(class) method, standard OO terminology * original : the original, the first, the basic version of the method (e.g. C-level one) * previous : the previous version of this method, the overridden one (either the original one, or an already redefined) ---------------------------------------- Feature #5005: Provide convenient access to original methods http://redmine.ruby-lang.org/issues/5005 Author: Lazaridis Ilias Status: Open Priority: Normal Assignee: Category: core Target version: 2.0 The languag allows a class to be "reopened", thus it's behaviour can be redefined: class String def any_method #custom code end end the original method can be called, using this construct: class String alias_method :original_any_method, :any_method def any_method(*args) #custom code original_any_method(*args) #custom code end end In order to make this more convenient, the following construct could be provided: class String def any_method(*args) #custom code original # call the original String#any_method, passing *args (similar to "super") #custom code end end "original" would behave similar to "super" The term "original" can be replaced by any term which describes this concept better. -- http://redmine.ruby-lang.org