From: Adam Gardner Date: 2009-04-12T06:27:49+09:00 Subject: Re: a few thoughts for ruby... Roger Pack wrote: > Thought I'd pass these thoughts by the readers here before sending them > to core. They're my current wish list :) > > 1) add an Object#in? method to complement the existing Array#include? > > 2) add some useful lists of exceptions, ex: IO.SELECT_EXCEPTIONS, > IO.READ_EXCEPTIONS, so that you can rescue the wide gamut of them > appropriately, should you desire to. > > 3) provide an easier way to know which platform you're on than > RUBY_PLATFORM =~ /mswin32|dgjpp|mingw/ > > 4) (this one's controversial) remove the extra # for code in strings > (i.e. "string#{code}") -> "string{code}" less typing. > > 5) add a BigDecimal(float) method. > -> BigDecimal.new("%f" % float) > > 6) add Dir.directory? > -> File.directory? > > Feedback? > Thanks! > -=r Object#in? can be very useful in keeping code legible; it more likely to be problematic in some circumstances than others. I'm using it in the game I'm writing right now and it's working just fine, but I don't really think it should be part of Ruby Core. That said, it's very very easy to add yourself if you need it: class Object def in?(object) if object.respond_to?(:include?) then object.include? self else false end end #def in? end #class Object -- Posted via http://www.ruby-forum.com/.