Skip to content

Instantly share code, notes, and snippets.

@andresmijares
Created March 19, 2017 20:08
Show Gist options
  • Save andresmijares/43b9d5db67dd7ea63333b0657e2b9983 to your computer and use it in GitHub Desktop.
Save andresmijares/43b9d5db67dd7ea63333b0657e2b9983 to your computer and use it in GitHub Desktop.
class Gateway {
exec (command, ...rest) {
if (this[command]) {
return this[command].apply(this, rest)
}
throw Error(`${this.constructor.name} does not have a method called ${command}.`)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment