提交 89060b8e 编写于 作者: G Gilad Zohari

Remove duplication from date_time calculations

Methods: :past? and :future? are already defined identically
in date_and_time/calculations.rb which is included in Date.
Because DateTime is a subclass of Date, it can call them.
上级 ffb680e1
......@@ -10,16 +10,6 @@ def current
end
end
# Tells whether the DateTime object's datetime lies in the past.
def past?
self < ::DateTime.current
end
# Tells whether the DateTime object's datetime lies in the future.
def future?
self > ::DateTime.current
end
# Seconds since midnight: DateTime.now.seconds_since_midnight.
def seconds_since_midnight
sec + (min * 60) + (hour * 3600)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册