Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I document generated classes in Yard?

Tags:

ruby

rdoc

yard

I have a class that I create from a factory function like this:

Cake = MyProject.Struct(:type, :price)

In Yard, it's simply displayed along with my constants:

Cake =

        Struct(:type, :price)

I want it to show up in the "Classes: " list. After reading up on the docs, I was lead to believe that this would work:

# @!parse class Cake; end
Cake = MyProject.Struct(:type, :price)

But it literally changed nothing.

Is it possible to get Yard to document dynamically created classes as classes?

like image 779
Hubro Avatar asked Nov 07 '14 12:11

Hubro


1 Answers

It has been quite some time since this was asked, but while googling for an answer myself, I was lead here, and figured to post my solution in case anyone else stumbles here.

I found that this solved it:

class Cake < Struct.new(:type, :cake)
end
like image 74
ForeverZer0 Avatar answered Nov 08 '22 17:11

ForeverZer0