Afficher un message
Vieux 22/02/2008, 10h48   #1
Giant Cranes
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Reduce three line method to one line

Hi,

I am trying to get the following method down to 1 line so that I can
lazy-load it.

def get_category_data(category_id)
rows = []
FasterCSV.parse(@data) { |row| rows << row if row[0] == category_id }
rows
end

I'm sure that there a few ways to do it in ruby, any pointers would be
much appreciated.

Thanks,
GiantCranes
--
Posted via http://www.ruby-forum.com/.

  Réponse avec citation
 
Page generated in 0,04145 seconds with 9 queries