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

Diff for: lib/time.rb

+1
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

Diff for: test/test_time.rb

+7
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)