On 11.06.2007 19:28, Marc Heiler wrote:
> Whops, that was a quick too fast. It seems to work with:
> 
> require 'yaml','pp'
> 
> but not with:
> 
> require %w( yaml pp )
> 
> TypeError: can't convert Array into String

You need require *%w(...) with the redefinition that Jesse gave.  Note 
the asterix.

> One reason why I do not so much like require 'something' is because of 
> the
> '' :)

Well, then you can do this - even without hacking the standard require:

%w{pathname fileutils English abbrev}.each {|r| require r}

Or, formatted differently

%w{
pathname
fileutils
English
abbrev
}.each {|r| require r}

IMHO changing "require" is not such a good idea as this change will be 
overridden if you use gems for example.  If you want multiple arguments, 
then I'd rather define a new method

def r(*a) a.flatten.each {|f| require f} end

Then you can do

r %w{
   pathname
   fileutils
   English
   abbrev
}

r 'pathname',
   'fileutils',
   'English',
   'abbrev'

You can even replace the #each with #map to get all the return values.

Cheers

	robert