-
Notifications
You must be signed in to change notification settings - Fork 216
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
Conversation
There was a problem hiding this 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 😮.
templates/template.rb
Outdated
@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/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@c_function_name = if @ruby_full_name =~ /^RBS::Types/ | |
@c_function_name = if @ruby_full_name.start_with? 'RBS::Types' |
Ah nvm, it's a conditional dependency: Lines 52 to 54 in 3fc6b05
|
An alternative implementation is to provide the same method via a refinement. |
... by replacing `demodulize` and `underscore` with hand-written regexps.
ed60476
to
fa54237
Compare
@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. |
... by replacing
demodulize
andunderscore
with hand-written regexps.