Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions core/time.rbs
Original file line number Diff line number Diff line change
Expand Up @@ -1353,7 +1353,7 @@ class Time < Object
# The returned array is suitable for use as an argument to Time.utc or
# Time.local to create a new `Time` object.
#
def to_a: () -> [ Integer, Integer, Integer, Integer, Integer, Integer, Integer, Integer, bool, String ]
def to_a: () -> [ Integer, Integer, Integer, Integer, Integer, Integer, Integer, Integer, bool, String? ]

# <!--
# rdoc-file=time.c
Expand Down Expand Up @@ -1584,7 +1584,7 @@ class Time < Object
# Time.utc(2000, 1, 1).zone # => "UTC"
# Time.new(2000, 1, 1).zone # => "Central Standard Time"
#
def zone: () -> String
def zone: () -> String?

# <!-- rdoc-file=time.c -->
# Like Time.utc, except that the returned `Time` object has the local timezone,
Expand Down
19 changes: 19 additions & 0 deletions test/stdlib/Time_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,25 @@ def test_new
end
end

class TimeInstanceTest < Test::Unit::TestCase
include TestHelper
testing "::Time"

def test_to_a
assert_send_type "() -> [ Integer, Integer, Integer, Integer, Integer, Integer, Integer, Integer, bool, String ]",
Time.now, :to_a
assert_send_type "() -> [ Integer, Integer, Integer, Integer, Integer, Integer, Integer, Integer, bool, nil ]",
Time.now(in: 0), :to_a
end

def test_zone
assert_send_type "() -> String",
Time.now, :zone
assert_send_type "() -> nil",
Time.now(in: 0), :zone
end
end

class TimeInDateTest < Test::Unit::TestCase
include TestHelper

Expand Down