似乎这将是一个相当常见的模式 - 声明数组并返回它:
def self.show_day_rows(days, month, year, offset)
daylines=[]
1.step(days,7).each do |line_starts_with|
daylines << CalDay.line_of_day_nums(month, year, line_starts_with, offset)
end
daylines
end
有没有办法缩短这个但仍然清晰?