2013-05-28 103 views
1

如何在Ruby中使用YUIDoc評論?我能想出的最好的是這樣的:Ruby中的Yuidoc風格評論?

##* 
    # Get Query history 
    # @type {Array} Past search query objects 
    # @param {int} limit The number of objects to return. Defaults to 10. (Max 100). 
    # @param {boolean} only_visible limit the search to visible items. Defaults to true. 
    # 

而且這樣的:

#/** 
    # * Get Query history 
    # * @type {Array} Past search query objects 
    # * @param {int} limit The number of objects to return. Defaults to 10. (Max 100). 
    # * @param {boolean} only_visible limit the search to visible items. Defaults to true. 
    # */ 

回答

1

你必須嵌入YUIDoc評論Ruby的多行註釋裏面,像這樣:

=begin 
/** 
* Get Query history 
* @type {Array} Past search query objects 
* @param {int} limit The number of objects to return. Defaults to 10. (Max 100). 
* @param {boolean} only_visible limit the search to visible items. Defaults to true. 
*/ 
=end 

=beginend之前的字符必須是該行第一列的

+0

有趣。這被認爲是確定的風格?請讓我聲明,我是一個JavaScript開發人員,擁有極少的導軌體驗。它幾乎看起來像CDATA塊或什麼的。順便說一下.. = begin和= end實際上做了什麼? –

+0

@AlexKessaris'= begin'和'= end'是多行註釋的分隔符,類似於JavaScript中的'/ *'和'* /'。它們在Ruby代碼中很少見,但在這種情況下,它們是唯一的選擇。 – toro2k

+0

酷!感謝您在這件事上的幫助。順便提一句,我很想知道更多關於Ruby評論的選項。我會在網上查找它,但你的想法也非常受歡迎! –