Skip to content

Instantly share code, notes, and snippets.

@ColinCampbell
Created October 6, 2011 18:22
Show Gist options
  • Save ColinCampbell/1268181 to your computer and use it in GitHub Desktop.
Save ColinCampbell/1268181 to your computer and use it in GitHub Desktop.
myRestrictedProp: function(key, value) {
myAllowedValues = ['here', 'there'];
if (value !== undefined) {
if (myAllowedValues.indexOf(value) === -1) {
throw "You tried to set a value that isn't allowed! " + value;
} else {
this._myRestrictedProp = value;
}
}
return this._myRestrictedProp;
}.property().cacheable()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment