[ruby/time] Alias value or join to take in old Ruby

https://github.com/ruby/time/commit/2a1827b0ce
This commit is contained in:
Hiroshi SHIBATA 2025-06-03 16:41:19 +09:00
parent d609a23115
commit 365d5b6bf4
No known key found for this signature in database
GPG Key ID: F9CF13417264FAC2

View File

@ -74,6 +74,9 @@ class TestTimeExtension < Test::Unit::TestCase # :nodoc:
if defined?(Ractor) if defined?(Ractor)
def test_rfc2822_ractor def test_rfc2822_ractor
assert_ractor(<<~RUBY, require: 'time') assert_ractor(<<~RUBY, require: 'time')
class Ractor
alias value take unless method_defined? :value # compat with Ruby 3.4 and olders
end
actual = Ractor.new { Time.rfc2822("Fri, 21 Nov 1997 09:55:06 -0600") }.value actual = Ractor.new { Time.rfc2822("Fri, 21 Nov 1997 09:55:06 -0600") }.value
assert_equal(Time.utc(1997, 11, 21, 9, 55, 6) + 6 * 3600, actual) assert_equal(Time.utc(1997, 11, 21, 9, 55, 6) + 6 * 3600, actual)
RUBY RUBY