Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我刚刚遇到了在 Ruby 中获取一系列日期的奇怪行为。
(Date.new(2012, 4, 1)..Date.today).select { |d| p d }作品
(Date.new(2012, 4, 1)..Date.today).select { |d| p d }
(Date.today..Date.new(2012, 4, 1)).select { |d| p d }失败。
(Date.today..Date.new(2012, 4, 1)).select { |d| p d }
任何想法?谢谢!
该范围不能向后移动,因此它返回一个空数组。