Skip to content

Commit c784e4f

Browse files
kirsnobu
authored andcommitted
Make Time friendly to Ractor
1 parent 6b8cc47 commit c784e4f

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

lib/time.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# frozen_string_literal: true
2+
# shareable_constant_value: literal
23

34
require 'date'
45

test/test_time.rb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,13 @@ def test_rfc2822
6262
assert_equal(true, t.utc?)
6363
end
6464

65+
if defined?(Ractor)
66+
def test_rfc2822_ractor
67+
actual = Ractor.new { Time.rfc2822("Fri, 21 Nov 1997 09:55:06 -0600") }.take
68+
assert_equal(Time.utc(1997, 11, 21, 9, 55, 6) + 6 * 3600, actual)
69+
end
70+
end
71+
6572
def test_encode_rfc2822
6673
t = Time.utc(1)
6774
assert_equal("Mon, 01 Jan 0001 00:00:00 -0000", t.rfc2822)

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy