Creating classes *manually*
e00dan opened this issue · 3 comments
e00dan commented
Is it possible to create class documentation for code that doesn't use @class
syntax? Eg.
###
# Class responsible for managing user's config
# @class Config
# @namespace Application
###
App.Config = Em.Object.extend
keys: [
App.ConfigKey.create
Name: 'downloadPath'
DefaultValue: ''
App.ConfigKey.create
Name: 'language'
DefaultValue: 'en'
App.ConfigKey.create
Name: 'platform'
DefaultValue: 'windows'
]
columns: [
new Column 'Id', 'INTEGER', false, true, true
new Column 'Key', 'TEXT', true, false, false, true
new Column 'Value', 'TEXT'
]
###
# Method to get complete SQL code to create Config table.
# @return {String} SQL code for Config table.
# @memberof Config
###
getCreateTableSQL: ->
columns = @get 'columns'
len = columns.length
columnsSQL = ''
for column, i in columns
columnsSQL += if len - 1 is i then column.getSQL() else column.getSQL() + ', '
'CREATE TABLE IF NOT EXISTS `config` (' + columnsSQL + ')'
This code displays only Config class in Classes, without any members.
sixmen commented
use @ method tag. (and tag is case-sensitive. use memberOf)
# @method getCreateTableSQL
# @memberOf Config
Kuzirashi commented
Ok, that works, but only if it is not indented using tab. I suppose this is a bug.
This works:
###
# @method getCreateTableSQL
# @memberOf Config
###
getCreateTableSQL: ->
columns = @get 'columns'
len = columns.length
columnsSQL = ''
for column, i in columns
columnsSQL += if len - 1 is i then column.getSQL() else column.getSQL() + ', '
'CREATE TABLE IF NOT EXISTS `config` (' + columnsSQL + ')'
This doesn't work:
###
# @method getCreateTableSQL
# @memberOf Config
###
getCreateTableSQL: ->
columns = @get 'columns'
len = columns.length
columnsSQL = ''
for column, i in columns
columnsSQL += if len - 1 is i then column.getSQL() else column.getSQL() + ', '
'CREATE TABLE IF NOT EXISTS `config` (' + columnsSQL + ')'