/* values for exposes: true: all set/getFoo are converted to setters/getters false: do nothing string: "foo" => only convert get/setFoo to setters getters if present array of strings: like above, but for each string */ Class.Mutators.Exposes = function(self, attributes){ if (attributes !== true) attributes = $splat(attributes); for (method in self) { var match = method.match(/^(get|set)([A-Z])(\w*)$/); if (match) { var prop = match[2].toLowerCase() + match[3]; if (attributes !== true && !attributes.contains(prop)) continue; self[(match[1] == 'get') ? '__defineGetter__' : '__defineSetter__'](prop, self[method]); } } };