Forum: Ruby Re: A more elegant way to do this?

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Gennady B. (Guest)
on 2006-05-11 10:19
(Received via mailing list)
Array() will do the job:

Array(nil) => []
Array([1,2,3]) => [1, 2, 3]
Array(1) => [1]

In your case:

Array(conf['hosts'][hostname]['groups']).each { ... }

This topic is locked and can not be replied to.