Skip to content

Instantly share code, notes, and snippets.

@starkhorn
Created November 4, 2012 05:12
Show Gist options
  • Save starkhorn/4010409 to your computer and use it in GitHub Desktop.
Save starkhorn/4010409 to your computer and use it in GitHub Desktop.
New person with function block in coffeescript
class Person
constructor: (block) ->
block.call this
about: ->
"My name is #{@name}, I am #{@age}"
me = new Person ->
this.name = "Ohm"
this.age = 25
console.log "About me => #{me.about()}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment