Generar nombres de clases sin utilizar eval en coffescript
Esto también te interesa!
PREGUNTAS SIMILARES
#2
alert = alert or console.log
gen = (clsname, val) ->
C = class
C.prototype[val] = ->
"#{clsname} says #{val}"
C
Gato = gen 'Gato', 'meow'
console.log Gato g = new Gato alert g.meow()
Perro= gen 'Perro', 'woff'
d = new Perro alert d.woff()