我有一个类似于这的ActiveRecord类:
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<textarea id="revbox" style="height: 50px; width: 260px;"></textarea>
<script>
$('textarea#revbox').on("mouseenter",function () {
$('textarea#revbox').animate({ height: 150 }, 1000);
});
$('textarea#revbox').on("mouseleave",function () {
$('textarea#revbox').animate({ height: 50 }, 1000);
});
</script>
class User < ActiveRecord::Base
# How do I document this?
enum status [:registering, :active, :suspended, :deleted]
end
属性用于构建状态机。如何使用码文件记录该行代码?文档需要包含status
属性及其所有可能状态的解释。
答案 0 :(得分:5)
class User < ActiveRecord::Base
# @attr [Enumerable<Symbol>] status
enum status [:registering, :active, :suspended, :deleted]
end
答案 1 :(得分:4)
只需将所有选项列为逗号分隔列表。
class User < ActiveRecord::Base
# @!attribute [rw] status
# @return [:registering, :active, :suspended, :deleted]
enum status [:registering, :active, :suspended, :deleted]
end
如果您不确定类型定义,可以咨询YARD Type Parser: