Git Product home page Git Product logo

Comments (7)

drbrain avatar drbrain commented on September 28, 2024

I think the best way to accomplish this would be through a parser for spec files. https://github.com/rdoc/rdoc-rake is a parser for rake files that you could use as an example.

Instead of creating new classes to contain spec data the parser would look up the corresponding class and add the "Spec:" section to the existing comment.

This may require some changes to rdoc to ensure that the spec parser runs after other directories are parsed, but I would be happy to assist with those.

from rdoc.

adamsanderson avatar adamsanderson commented on September 28, 2024

Hey thanks, it was the bit around ensuring rdoc runs the spec parsing after the other directories were parsed where I thought I'd need help since I think rdoc tends to replace comments instead of append to them (?).

from rdoc.

drbrain avatar drbrain commented on September 28, 2024

The ruby parser overwrites method comments but not class comments. Usually classes and modules are extended through reopening but defining a method twice for the same class is not a good idea. Try running rdoc on this example:

# class comment 1
class C
  # method comment 1
  def m
  end
end

# class comment 2
class C
  # method comment 2
  def m
  end
end

If you write a custom parser for spec files this does not have to be true. You can look up a method and append to its comment instead of overwriting it just like for a class.

from rdoc.

adamsanderson avatar adamsanderson commented on September 28, 2024

Great, then it's just a matter of ensuring the correct ordering (ie: stdlib and then the specs).

from rdoc.

drbrain avatar drbrain commented on September 28, 2024

And writing a parser for specs, of course

from rdoc.

drbrain avatar drbrain commented on September 28, 2024

Closing this bug as I am not going to write the spec parser.

from rdoc.

adamsanderson avatar adamsanderson commented on September 28, 2024

No problem, thanks for the information :)

from rdoc.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.