Skip to content

Commit fa54237

Browse files
committed
Quick refactoring
1 parent a67186b commit fa54237

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

templates/template.rb

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,9 @@ def initialize(yaml)
4747
@ruby_full_name = yaml["name"]
4848
@ruby_class_name = @ruby_full_name[/[^:]+\z/] # demodulize-like
4949
name = @ruby_full_name.gsub("::", "_")
50-
name = name.gsub(/(^)?(_)?([A-Z](?:[A-Z]*(?=[A-Z_])|[a-z0-9]*))/) { ($1 || $2 || "_") + $3.downcase } # underscore-like
51-
@c_function_name = if @ruby_full_name =~ /^RBS::Types/
52-
name.gsub("_types_", "_")
53-
else
54-
name.gsub("_declarations_", "_decl_")
55-
end
50+
@c_function_name = name.gsub(/(^)?(_)?([A-Z](?:[A-Z]*(?=[A-Z_])|[a-z0-9]*))/) { ($1 || $2 || "_") + $3.downcase } # underscore-like
51+
@c_function_name.gsub!(/^rbs_types_/, 'rbs_')
52+
@c_function_name.gsub!(/^rbs_ast_declarations_/, 'rbs_ast_decl_')
5653
@c_constant_name = @ruby_full_name.gsub("::", "_")
5754
@c_parent_constant_name = @ruby_full_name.split("::")[0..-2].join("::").gsub("::", "_")
5855

0 commit comments

Comments
 (0)