From: "David A. Black" Date: 2009-01-04T05:00:57+09:00 Subject: Re: What does 'Monkey Patching' exactly Mean in Ruby? Hi -- On Sun, 4 Jan 2009, Phlip wrote: >> That is not entirely true. For one the array has each_with_index but I >> could not find collect_with_index. > > Then you should have written Array#collect_my_foo_objects_with_index, to > avoid a collision. > > Monkey patching is not for adding our own convenience methods, it is for > changing library code's internal behavior. That's the tail wagging the dog, though. There's no pre-determined practice called "monkey patching" that delineates what can or should be done. You can add convenience methods and also change internal behavior. It doesn't really matter, in the end, which one (or neither) gets called "monkey patching". ("Neither" would be my option of choice :-) David -- David A. Black / Ruby Power and Light, LLC Ruby/Rails consulting & training: http://www.rubypal.com Coming in 2009: The Well-Grounded Rubyist (http://manning.com/black2) http://www.wishsight.com => Independent, social wishlist management!