davfuenmayor / ruby-doxygen-parser

Ruby library that uses Doxygen XML output to parse and query C++ header files
MIT License
4 stars 2 forks source link

Ruby 3 support #3

Closed susan31213-a closed 2 months ago

susan31213-a commented 2 months ago

Hi! Thank you for this great ruby gem! I'm using this gem to parse doxygen xml in Ruby 3.2.2 but encounter an error.

/Users/myname/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/doxyparser-1.5.1/lib/nodes/compound.rb:32:in `parse': undefined method `exists?' for File:Class (NoMethodError)

      raise "No file found at this location: #{@xml_path} for node #{self.class.name} #{@name}" unless File.exists? @xml_path
                                                                                                           ^^^^^^^^
Did you mean?  exist?
    from /Users/myname/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/doxyparser-1.5.1/lib/nodes/compound.rb:26:in `doc'
    from /Users/myname/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/doxyparser-1.5.1/lib/nodes/hfile.rb:33:in `classes'
    from /Users/myname/myproject.rb:59:in `parse'
    from ./myproject.rb:93:in `block (2 levels) in <main>'
    from ./myproject.rb:81:in `foreach'
    from ./myproject.rb:81:in `block in <main>'
    from ./myproject.rb:60:in `foreach'
    from ./myproject.rb:60:in `<main>'

I found it is because File.exists? is removed from Ruby 3.2. Could I create a PR to fix it?

susan31213-a commented 2 months ago

I added a gem named file_exists and it works! Just leave this comment to help others encounter the same error.