Source

model / model_app / models.coffee

Full commit
class DiagramElement extends Backbone.Model
  defaults:
    x: 0
    y: 0
    width: 40
    height: 100

class Class extends DiagramElement
  defaults:
    name: ""
    super_classes: []
    public_methods: []
    private_methods: []

  has_super: =>
    @get("super_classes").length > 0

  get_all_members: =>
    result = []
    name = @get("name")
    if @get("super_classes").length > 0
      name += " : "
      name += @get("super_classes").join(",")
    result.push name
    _.each @get("public_methods"), (n) ->
      result.push n

    _.each @get("private_methods"), (n) ->
      result.push n

    result

class ClassDiagram extends Backbone.Collection
  model: Class
  source: ""
  get_classes: =>
    (model.get 'name' for model in @models)


exports = this
exports.Class = Class
exports.current_diagram = new ClassDiagram