0
這裏我得到有序的工作日數組。它適用於我,但看起來非常糟糕。純垃圾)。有沒有(我確定有一個)重構它的任何方式?(看起來更清潔?)一個乾淨的方式來寫循環
def weekdays
(deduct_weekdays.map{|day| day.strftime("%A")}).reverse!
end
private
def deduct_weekdays
arr = []
@n = 0
7.times do
arr << DateTime.now - @n
@n += 1
end
arr
end