Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Complex and BigDecimal for Date#{+,-} #830

Merged
merged 1 commit into from
Dec 1, 2021
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: 4 additions & 0 deletions core/builtin.rbs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ interface _ToInt
def to_int: -> Integer
end

interface _ToR
def to_r: () -> Rational
end

interface _ToS
def to_s: -> String
end
Expand Down
4 changes: 2 additions & 2 deletions stdlib/date/0/date.rbs
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,7 @@ class Date
# DateTime.jd(0,12) + DateTime.new(2001,2,3).ajd
# #=> #<DateTime: 2001-02-03T00:00:00+00:00 ...>
#
def +: (Integer | Rational other) -> Date
def +: ((Numeric & _ToR) other) -> Date

# Returns the difference between the two dates if the other is a date object.
# If the other is a numeric value, returns a date object pointing `other` days
Expand All @@ -461,7 +461,7 @@ class Date
# DateTime.new(2001,2,3) - DateTime.new(2001,2,2,12)
# #=> (1/2)
#
def -: (Integer | Rational other) -> Date
def -: ((Numeric & _ToR) other) -> Date
| (Date other) -> Rational

# Returns a date object pointing `n` months before self. The argument `n` should
Expand Down