Fix warning in Rubies that already have the method

This commit is contained in:
Rafael Mendonça França 2020-10-30 21:00:40 +00:00
parent 45a1bcea9b
commit 0b72dd37c1
No known key found for this signature in database
GPG Key ID: FC23B6D0F1EEE948

@ -6,6 +6,7 @@
require "active_support/core_ext/time/zones"
require "active_support/core_ext/date_and_time/calculations"
require "active_support/core_ext/date/calculations"
require "active_support/core_ext/module/remove_method"
class Time
include DateAndTime::Calculations
@ -116,6 +117,7 @@ def floor(precision = 0)
# Restricted Ruby version due to a bug in `Time#ceil`
# See https://bugs.ruby-lang.org/issues/17025 for more details
if RUBY_VERSION <= "2.7.1"
remove_possible_method :ceil
def ceil(precision = 0)
change(nsec: 0) + subsec.ceil(precision)
end