Skip to content

Instantly share code, notes, and snippets.

@leafo
Created August 1, 2014 02:59
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save leafo/99d0817d28771f8ffe4e to your computer and use it in GitHub Desktop.
Save leafo/99d0817d28771f8ffe4e to your computer and use it in GitHub Desktop.
class Test
__field_missing: (name) =>
print "method is missing:", name
old = @__base.__index
@__base.__index = (name) =>
old[name] or @__field_missing name
x = Test!
x.hello -- will trigger the __field_missing method in the class
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment