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

Remove the dependency to activesupport #2106

Merged
merged 2 commits into from
Dec 3, 2024
Merged

Conversation

mame
Copy link
Member

@mame mame commented Nov 29, 2024

... by replacing demodulize and underscore with hand-written regexps.

Copy link
Contributor

@ParadoxV5 ParadoxV5 left a comment

Choose a reason for hiding this comment

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

Fixes #2105 (comment)

underscore-like is so complex 😮.

@ruby_class_name = @ruby_full_name.demodulize
@ruby_class_name = @ruby_full_name[/[^:]+\z/] # demodulize-like
name = @ruby_full_name.gsub("::", "_")
name = name.gsub(/(^)?(_)?([A-Z](?:[A-Z]*(?=[A-Z_])|[a-z0-9]*))/) { ($1 || $2 || "_") + $3.downcase } # underscore-like
@c_function_name = if @ruby_full_name =~ /^RBS::Types/
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
@c_function_name = if @ruby_full_name =~ /^RBS::Types/
@c_function_name = if @ruby_full_name.start_with? 'RBS::Types'

@amomchilov
Copy link
Contributor

amomchilov commented Nov 29, 2024

activesupport was already an indirect dependency of RBS, and it still is after this PR, because steep depends on it. Is there a plan to remove activesupport from steep?

Ah nvm, it's a conditional dependency:

rbs/Gemfile

Lines 52 to 54 in 3fc6b05

group :typecheck_test do
gem "steep", "~> 1.8.0.pre", require: false
end

@HoneyryderChuck
Copy link
Contributor

An alternative implementation is to provide the same method via a refinement.

mame and others added 2 commits December 3, 2024 15:03
... by replacing `demodulize` and `underscore` with hand-written
regexps.
@soutaro soutaro force-pushed the remove-activesupport branch from ed60476 to fa54237 Compare December 3, 2024 06:13
@soutaro
Copy link
Member

soutaro commented Dec 3, 2024

@amomchilov Yeah, it's subtle thing... The problem is for Ruby core developers who don't install full-development setup of RBS. They often develop without bundler or maybe rubygems, so having less dependency to minimum setup for RBS makes more sense for the case.

It was my fault that I didn't notice the problem when I was reviewing your initial PR. Looks like this change works good.

@soutaro soutaro added this pull request to the merge queue Dec 3, 2024
Merged via the queue into master with commit ec3bb73 Dec 3, 2024
18 checks passed
@soutaro soutaro deleted the remove-activesupport branch December 3, 2024 06:23
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.

5 participants