coffeedoc/codo

Using CoffeeScript with AngularJS

dbartholomae opened this issue · 1 comments

Hi there,

what would be the best way to document this kind of project with codo:

require 'restangular'
module.exports = require('angular').module 'backend', ['restangular']
.factory 'backend', ['Restangular', (Restangular) ->
  new class Backend
    constructor: ->
      Restangular.withConfig (provider) ->
        provider.setBaseUrl "some.url.com"
]
.name

Given that the class definition isn't on the top level, any comments before defining the class are not used for documentation. Unfortunately I need to have the class definition inside the function, as this is the way dependency injection is handled in angular: Otherwise I would not have access to Restangular.

Any ideas on best practices for this case?

I found the reason why it isn't working: The assignment is parsed as a variable with the functions sourcecode as a value. Furthermore the case new class hadn't yet been taken care of in the traverser. I fixed both and then some. Currently everything is in #217, but I can split it up in different packages if needed.