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

Add Time (extension) signatures #511

Merged
merged 1 commit into from
Dec 16, 2020
Merged

Add Time (extension) signatures #511

merged 1 commit into from
Dec 16, 2020

Conversation

ybiquitous
Copy link
Contributor

This change adds signatures for a Time class extension (not built-in) via require "time".

Note:

See also:

This change adds signatures for a `Time` class extension (not built-in) via `require "time"`.

Note:
- Generated signatures by the `rbs prototype runtime --require time Time` command conflicts
  with the existing signatures in `core/time.rbs`:
  https://github.com/ruby/rbs/blob/71b8e534e0adcc78aa76ffbd0326ffe01594d520/core/time.rbs
- So, I use the command `rbs prototype rb rbs prototype rb /usr/local/lib/ruby/2.7.0/time.rb`,
  and edit the majority of the generated file by hand (especially, remove the private APIs).

See also:
- https://github.com/ruby/ruby/blob/v2_7_2/lib/time.rb
- https://ruby-doc.org/stdlib-2.7.2/libdoc/time/rdoc/Time.html
@@ -0,0 +1,327 @@
class Time
interface _TimeLike
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[note] I cannot find a good name... 😓

@@ -0,0 +1,119 @@
require_relative "test_helper"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[note] Compared with Time_test.rb, the file name TimeExtension_test.rb may be confusing... 🤔
I'm open for a better name suggestion.

Copy link
Member

@soutaro soutaro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👏

@soutaro soutaro merged commit 302a6f6 into ruby:master Dec 16, 2020
@ybiquitous ybiquitous deleted the stdlib-time branch December 16, 2020 08:39
@ybiquitous
Copy link
Contributor Author

@soutaro Thank you! 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants