Skip to content

Commit daf0680

Browse files
committed
Support only .h
1 parent cede6ec commit daf0680

File tree

1 file changed

+12
-0
lines changed
  • _tools/ruby_h_to_go/lib/ruby_h_to_go

1 file changed

+12
-0
lines changed

_tools/ruby_h_to_go/lib/ruby_h_to_go/cli.rb

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ def write_type_definitions_to_go_file
4343
end
4444

4545
type_definitions.each do |definition|
46+
next unless target_header_file?(definition.filepath)
47+
4648
definition.write_go_file(dist_dir)
4749
end
4850
end
@@ -53,6 +55,8 @@ def write_struct_definitions_to_go_file
5355
end
5456

5557
struct_definitions.each do |definition|
58+
next unless target_header_file?(definition.filepath)
59+
5660
definition.write_go_file(dist_dir)
5761
end
5862
end
@@ -73,6 +77,8 @@ def write_function_definitions_to_go_file
7377
end
7478

7579
function_definitions.each do |definition|
80+
next unless target_header_file?(definition.filepath)
81+
7682
definition.write_go_file(dist_dir)
7783
end
7884
end
@@ -109,5 +115,11 @@ def go_fmt
109115
system("go fmt", exception: true)
110116
end
111117
end
118+
119+
# @param filename [String]
120+
# @return [Boolean]
121+
def target_header_file?(filename)
122+
File.extname(filename) == ".h"
123+
end
112124
end
113125
end

0 commit comments

Comments
 (0)