()
| 1116 | } |
| 1117 | |
| 1118 | static refreshAttributes() { |
| 1119 | const attributeManipulation = {}; |
| 1120 | |
| 1121 | this.prototype._customGetters = {}; |
| 1122 | this.prototype._customSetters = {}; |
| 1123 | |
| 1124 | ['get', 'set'].forEach(type => { |
| 1125 | const opt = `${type}terMethods`; |
| 1126 | const funcs = { ...this.options[opt] }; |
| 1127 | const _custom = type === 'get' ? this.prototype._customGetters : this.prototype._customSetters; |
| 1128 | |
| 1129 | _.each(funcs, (method, attribute) => { |
| 1130 | _custom[attribute] = method; |
| 1131 | |
| 1132 | if (type === 'get') { |
| 1133 | funcs[attribute] = function() { |
| 1134 | return this.get(attribute); |
| 1135 | }; |
| 1136 | } |
| 1137 | if (type === 'set') { |
| 1138 | funcs[attribute] = function(value) { |
| 1139 | return this.set(attribute, value); |
| 1140 | }; |
| 1141 | } |
| 1142 | }); |
| 1143 | |
| 1144 | _.each(this.rawAttributes, (options, attribute) => { |
| 1145 | if (Object.prototype.hasOwnProperty.call(options, type)) { |
| 1146 | _custom[attribute] = options[type]; |
| 1147 | } |
| 1148 | |
| 1149 | if (type === 'get') { |
| 1150 | funcs[attribute] = function() { |
| 1151 | return this.get(attribute); |
| 1152 | }; |
| 1153 | } |
| 1154 | if (type === 'set') { |
| 1155 | funcs[attribute] = function(value) { |
| 1156 | return this.set(attribute, value); |
| 1157 | }; |
| 1158 | } |
| 1159 | }); |
| 1160 | |
| 1161 | _.each(funcs, (fct, name) => { |
| 1162 | if (!attributeManipulation[name]) { |
| 1163 | attributeManipulation[name] = { |
| 1164 | configurable: true |
| 1165 | }; |
| 1166 | } |
| 1167 | attributeManipulation[name][type] = fct; |
| 1168 | }); |
| 1169 | }); |
| 1170 | |
| 1171 | this._dataTypeChanges = {}; |
| 1172 | this._dataTypeSanitizers = {}; |
| 1173 | |
| 1174 | this._hasBooleanAttributes = false; |
| 1175 | this._hasDateAttributes = false; |
no test coverage detected