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

starts_with? and ends_with? #190

Merged
merged 1 commit into from
Dec 18, 2023
Merged

starts_with? and ends_with? #190

merged 1 commit into from
Dec 18, 2023

Conversation

amomchilov
Copy link
Contributor

Type of Change

  • Add RBI for a new gem
  • Modify RBI for an existing gem
  • Other:

Changes

@amomchilov amomchilov requested a review from a team as a code owner December 16, 2023 01:52
@vinistock vinistock merged commit 7568f7d into main Dec 18, 2023
3 checks passed
@vinistock vinistock deleted the amomchilov-patch-1 branch December 18, 2023 13:41
@@ -259,3 +259,23 @@ class Time
sig { returns(TrueClass) }
def present?; end
end

class Symbol
# @shim: alias for `#start_with?`
Copy link
Contributor

Choose a reason for hiding this comment

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

Does it really need to be marked as @shim?

require "active_support"
Symbol.instance_method(:starts_with?) # => #<UnboundMethod: Symbol#starts_with?(start_with?)(*)>

Copy link
Contributor Author

Choose a reason for hiding this comment

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

TBH I don't even know what @shim does, I just cargo-culted it from the other sig 😅

Got any docs on it? Couldn't find any.

Copy link
Contributor

Choose a reason for hiding this comment

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

To avoid errors and outdated RBIs, rbi-central CI will check that the method actually exist at runtime.

@shim is used to disable this check when the method doesn't actually exist and the RBI definition is used to shim the actual behavior to make typing possible: https://github.com/Shopify/rbi-central?tab=readme-ov-file#runtime-checks

In your case, I don't think you need it since the definition actually exists.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh neat, thanks for pointing me to that!

Removed in #208

@Morriar Morriar added the rbi Change related to RBI annotations label Mar 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
rbi Change related to RBI annotations
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants