From: Daniel Sheppard Date: 2006-05-11T15:36:43+09:00 Subject: Re: A more elegant way to do this? > -----Original Message----- > From: Tim Uckun [mailto:timuckun@gmail.com] > > Can anybody suggest a more elegant and rubyish way to do this? > > unless conf['hosts'][hostname]['groups'].nil? > conf['hosts'][hostname]['groups'].each { |group| > unless conf['crontables'][group].nil? > conf['crontables'][group].each { | tab_item| > tab_entries << tab_item > } > end #Unless > } > end #unless use (value||[]), ie: (conf['hosts'][hostname]['groups']||[]).each { |group| (conf['crontables'][group]||[]).each { | tab_item| tab_entries << tab_item } }