I have some simple ruby code where I create an Array, create a bunch of objects and push them into the array and then return the array
def create_barcodes(count)
barcodes = Array.new
count.times { barcodes.push(Barcode.create) }
barcodes
end
It feels like there should be a way to reduce this to one or two lines and at a minimum avoid having to reference the barcodes array at the end so it gets returned. Is there some clever way to get the count loop to return the array?