From: Joel VanderWerf Date: 2007-05-19T03:14:10+09:00 Subject: Re: Hijack, or alias a method with a proc? Jim wrote: > Hello, > > I have a Menu class with a add_item method, which takes a name > followed by a proc: > > Menu("TopLevelMenuName").add_item("NewMenuItemName") { puts "Hello" } > > I want to hijack this method so I can customize the menu in which the > proc is associated. > > Class Menu > alias :_add_item :add_item > def add_item( *args ) def add_item( *args , &block ) > p args p args, block _add_item(*args, &block) > end > end > > This captures the menuname string, but how do I get at the associated > proc? > > Thanks. > -- vjoel : Joel VanderWerf : path berkeley edu : 510 665 3407