# File bin/header_to_ruby.rb, line 28
28:   def to_ruby
29:     content = self.dup
30: 
31:     # remove single-line comments
32:       content.gsub! %r{//(.*)$}, '#\1'
33: 
34:     # remove multi-line comments
35:       content.gsub! %r{/\*.*?\*/}m, "\n=begin\n\\0\n=end\n"
36: 
37:     # remove preprocessor directives
38:       content.gsub! %r{`include}, '#\0'
39:       content.gsub! %r{`define\s+(\w+)\s+(.+)}, '\1 = \2'
40:       content.gsub! %r{`+}, ''
41: 
42:     # change numbers
43:       content.gsub! %r{\d*\'([dohb]\w+)}, '0\1'
44: 
45:     # change ranges
46:       content.gsub! %r{(\S)\s*:\s*(\S)}, '\1..\2'
47: 
48:     content
49:   end