On Fri, Feb 09, 2007 at 08:00:11AM +0900, Phrogz wrote: > On Feb 8, 3:52 pm, "Lyle Johnson" <lyle.john... / gmail.com> wrote: [...] > > alias old_try try > > def try(hash) > > old_try(hash[:x], hash[:y], hash[:z]) > > end > > > > If someone calls this new and improved version of try() and provides a > > block, is there any way for me to somehow pass that block down into > > old_try() without actually modifying the method signature? > > Do you feel that this: > def try( hash, &block ) > old_try( hash[:x],hash[:y],hash[:z],&block ) > end > is somehow changing its signature? (You can still choose to pass a > block or not.) def old_try yield * 2 end def try(hash) old_try(&Proc.new) # probably breaking in 1.9 someday (works right now) end try(:a => 1) { "foo" } # => "foofoo" RUBY_VERSION # => "1.8.5" -- Mauricio Fernandez - http://eigenclass.org - singular Ruby ** Latest postings ** What's new in Ruby 1.9, Feb. 07 update http://eigenclass.org/hiki.rb?Changes-in-Ruby-1.9-update-6 Firebrigade: automated, sandboxed testing of RubyGems packages by other devels http://eigenclass.org/hiki.rb?firebrigade-launched