我有一个从工厂函数创建的类,如下所示:
Cake = MyProject.Struct(:type, :price)
在 Yard 中,它只是与我的常量一起显示:
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)
但它确实没有任何改变。
是否可以让 Yard 将动态创建的类记录为类?
最佳答案
自问到这个问题已经有一段时间了,但在谷歌搜索自己的答案时,我被引导到这里,并想发布我的解决方案以防其他人在这里绊倒。
我发现这解决了问题:
class Cake < Struct.new(:type, :cake)
end
关于ruby - 如何在 Yard 中记录生成的类?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26801135/