"leon breedt" <bitserf / gmail.com> schrieb im Newsbeitrag 
news:270bd0c40501041728ba09e80 / mail.gmail.com...
> On Wed, 5 Jan 2005 10:04:08 +0900, Bertram Scharpf
> <lists / bertram-scharpf.de> wrote:
>> I made both solutions available at
>> <http://projects.bertram-scharpf.de/tmp/arraysplit.tar.gz>.
> I had a look, perhaps it could emulate String#split by performing an
> "awk split" (on whitespace) if there is no delimiter argument given?
> Also, allowing a Regexp as a
> delimiter would further emulate the String#split functionality.

Another option would be an optional block that evaluates to true for 
delimiters.  I didn't look at the proposed implementation, but here's how 
I'd do it:

module Enumerable
  def split(delim = /\A\s*\z/, &b)
    b ||= lambda {|x| delim === x}
    inject([[]]) do |ar, x|
      if b.call x
        ar << []
      else
        ar[-1] << x
      end
      ar
    end
  end
end

Kind regards

    robert