[ruby/time] Do not redefine Time#xmlschema if it already exists

[Feature #20707]

Ruby 3.4 will define this method natively, so the time gem shouldn't
redefine it with a slower version.

https://github.com/ruby/time/commit/f05099ce38
This commit is contained in:
Jean Boussier 2024-09-05 10:06:01 +02:00 committed by git
parent f250296efa
commit 72acd1c8b1

View File

@ -695,6 +695,7 @@ class Time
getutc.strftime('%a, %d %b %Y %T GMT') getutc.strftime('%a, %d %b %Y %T GMT')
end end
unless method_defined?(:xmlschema)
# #
# Returns a string which represents the time as a dateTime defined by XML # Returns a string which represents the time as a dateTime defined by XML
# Schema: # Schema:
@ -724,6 +725,6 @@ class Time
end end
s << (utc? ? 'Z' : strftime("%:z")) s << (utc? ? 'Z' : strftime("%:z"))
end end
alias iso8601 xmlschema end
alias iso8601 xmlschema unless method_defined?(:iso8601)
end end