@@ -19,7 +19,7 @@ def initialize(header_dir)
19
19
20
20
# @return [Array<RubyHeaderParser::FunctionDefinition>]
21
21
def extract_function_definitions
22
- stdout = `ctags --recurse -- c-kinds=p --languages=C --language-force=C -- fields=+nS --extras=+q -f - #{ header_dir } ` # rubocop:disable Layout/LineLength
22
+ stdout = execute_ctags ( "-- c-kinds=p --fields=+nS --extras=+q" )
23
23
24
24
stdout . each_line . with_object ( [ ] ) do |line , definitions |
25
25
parts = line . split ( "\t " )
@@ -55,7 +55,7 @@ def extract_function_definitions
55
55
56
56
# @return [Array<RubyHeaderParser::StructDefinition>]
57
57
def extract_struct_definitions
58
- stdout = `ctags --recurse -- c-kinds=s --languages=C --language-force=C -- fields=+n -f - #{ header_dir } `
58
+ stdout = execute_ctags ( "-- c-kinds=s --fields=+n" )
59
59
60
60
stdout . each_line . with_object ( [ ] ) do |line , definitions |
61
61
parts = line . split ( "\t " )
@@ -73,7 +73,7 @@ def extract_struct_definitions
73
73
74
74
# @return [Array<RubyHeaderParser::TyperefDefinition>]
75
75
def extract_type_definitions
76
- stdout = `ctags --recurse -- c-kinds=t --languages=C --language-force=C -- fields=+n -f - #{ header_dir } `
76
+ stdout = execute_ctags ( "-- c-kinds=t --fields=+n" )
77
77
78
78
stdout . each_line . with_object ( [ ] ) do |line , definitions |
79
79
parts = line . split ( "\t " )
@@ -91,6 +91,12 @@ def extract_type_definitions
91
91
92
92
private
93
93
94
+ # @param args [String]
95
+ # @return [String]
96
+ def execute_ctags ( args = "" )
97
+ `ctags --recurse --languages=C --language-force=C #{ args } -f - #{ header_dir } `
98
+ end
99
+
94
100
# @param file [String]
95
101
# @param line_num [Integer]
96
102
def read_definition_from_header_file ( file , line_num )
0 commit comments