File tree Expand file tree Collapse file tree 3 files changed +5
-13
lines changed
Expand file tree Collapse file tree 3 files changed +5
-13
lines changed Original file line number Diff line number Diff line change @@ -19,7 +19,6 @@ gem 'tempfile'
1919gem "rdoc"
2020gem "fileutils"
2121gem "raap"
22- gem "activesupport"
2322
2423group :libs do
2524 # Libraries required for stdlib test
Original file line number Diff line number Diff line change @@ -158,7 +158,6 @@ PLATFORMS
158158
159159DEPENDENCIES
160160 abbrev
161- activesupport
162161 base64
163162 benchmark-ips
164163 bigdecimal
Original file line number Diff line number Diff line change 44require "fileutils"
55require "yaml"
66
7- require "active_support"
8- require "active_support/core_ext/string/inflections"
9-
107module RBS
118 class Template
129 class Field
@@ -48,14 +45,11 @@ class Type
4845
4946 def initialize ( yaml )
5047 @ruby_full_name = yaml [ "name" ]
51- @ruby_class_name = @ruby_full_name . demodulize
52- @c_function_name = if @ruby_full_name =~ /^RBS::Types/
53- name = @ruby_full_name . gsub ( "::" , "_" ) . underscore
54- name . gsub ( "_types_" , "_" )
55- else
56- name = @ruby_full_name . gsub ( "::" , "_" ) . underscore
57- name . gsub ( "_declarations_" , "_decl_" )
58- end
48+ @ruby_class_name = @ruby_full_name [ /[^:]+\z / ] # demodulize-like
49+ name = @ruby_full_name . gsub ( "::" , "_" )
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_' )
5953 @c_constant_name = @ruby_full_name . gsub ( "::" , "_" )
6054 @c_parent_constant_name = @ruby_full_name . split ( "::" ) [ 0 ..-2 ] . join ( "::" ) . gsub ( "::" , "_" )
6155
You can’t perform that action at this time.
0 commit comments