From: adamspitz@... (Adam Spitz) Date: 2002-01-05T04:53:14+09:00 Subject: [ruby-talk:30238] Re: chomp for arrays? How about something like this? module Enumerable def each_send(methodName) self.each { |e| e.send(methodName) if e.respond_to?(methodName) } end end array = [1, "two\n", "three"] array.each_send(:chomp!) p array # => [1, "two", "three"] Massimiliano Mirra wrote: > It would be nice to have a repository for people to share their > x[object].rb's, whatever name they call them. :-) Yesyesyes! Python people keep asking me why I'm so excited about Ruby's ability to add methods to existing classes. (It's possible in Python, but ugly and frowned-upon.) *This* is why. I want to see a big collection of all the methods that people have added to the built-in Ruby classes. I want to look over them and take the ones that look cool and play with them myself and improve them if I can. And then I want to see the really good ones make it back into the standard library. Adam Spitz