@@ -16,8 +16,8 @@ class Parser # rubocop:disable Metrics/ClassLength
1616 attr_reader :dist_preprocessed_header_file
1717
1818 # @!attribute [r] data
19- # @return [RubyHeaderParser::Data ]
20- attr_reader :data
19+ # @return [RubyHeaderParser::Config ]
20+ attr_reader :config
2121
2222 DEFAULT_HEADER_FILE = "#{ RbConfig ::CONFIG [ "rubyhdrdir" ] } /ruby.h" . freeze
2323
@@ -38,7 +38,7 @@ def initialize(dist_preprocessed_header_file: nil, header_file: DEFAULT_HEADER_F
3838 @header_file = header_file
3939 @include_paths = include_paths
4040 @dist_preprocessed_header_file = dist_preprocessed_header_file || File . join ( Dir . tmpdir , "ruby_preprocessed.h" )
41- @data = Data . new
41+ @config = Config . new
4242 end
4343
4444 # @return [Array<RubyHeaderParser::FunctionDefinition>]
@@ -59,7 +59,7 @@ def extract_struct_definitions
5959 parts = line . split ( "\t " )
6060
6161 struct_name = parts [ 0 ]
62- next unless data . should_generate_struct? ( struct_name )
62+ next unless config . should_generate_struct? ( struct_name )
6363
6464 definitions << StructDefinition . new (
6565 name : struct_name ,
@@ -76,7 +76,7 @@ def extract_type_definitions
7676
7777 type_name = parts [ 0 ]
7878
79- next unless data . should_generate_type? ( type_name )
79+ next unless config . should_generate_type? ( type_name )
8080
8181 definitions << TypeDefinition . new (
8282 name : type_name ,
@@ -97,7 +97,7 @@ def extract_enum_definitions
9797
9898 value = parts [ 0 ]
9999
100- next unless data . should_generate_enum? ( enum_name )
100+ next unless config . should_generate_enum? ( enum_name )
101101
102102 hash [ enum_name ] ||= EnumDefinition . new ( name : enum_name )
103103 hash [ enum_name ] . values << value
@@ -131,7 +131,7 @@ def generate_function_definition_from_line(line:, kind:, is_parse_multiline_defi
131131 function_name = parts [ 0 ]
132132 filepath = parts [ 1 ]
133133
134- return nil unless data . should_generate_function? ( function_name )
134+ return nil unless config . should_generate_function? ( function_name )
135135
136136 return nil unless parts [ 3 ] == kind
137137
@@ -228,7 +228,7 @@ def create_typeref(definition:, function_name:, typeref_field:, filepath:, line_
228228 typeref_pointer = nil
229229 if typeref_type . match? ( /\* +$/ )
230230 typeref_type = typeref_type . gsub ( /\* +$/ , "" ) . strip
231- typeref_pointer = data . function_self_pointer_hint ( function_name )
231+ typeref_pointer = config . function_self_pointer_hint ( function_name )
232232 end
233233
234234 TyperefDefinition . new ( type : typeref_type , pointer : typeref_pointer )
@@ -319,12 +319,12 @@ def analyze_argument_type(function_name:, arg_pos:, parts:)
319319 case original_type
320320 when /\* +$/
321321 type = original_type . gsub ( /\* +$/ , "" ) . strip
322- pointer = data . function_arg_pointer_hint ( function_name :, pos : arg_pos )
322+ pointer = config . function_arg_pointer_hint ( function_name :, pos : arg_pos )
323323
324324 when /^void\s */ , /\( .*\) /
325325 # function pointer (e.g. void *(*func)(void *)) is treated as `void*`
326326 type = "void"
327- pointer = data . function_arg_pointer_hint ( function_name :, pos : arg_pos )
327+ pointer = config . function_arg_pointer_hint ( function_name :, pos : arg_pos )
328328
329329 else
330330 type = original_type
0 commit comments