[IMP] rename openerp.base.Class.mix to openerp.base.Class.include, // to Ruby's name for the same behavior

bzr revid: xmo@openerp.com-20110808095750-yhg1ixaump4rq09x
This commit is contained in:
Xavier Morel 2011-08-08 11:57:50 +02:00
parent 2f94a513bd
commit f130d1c374
3 changed files with 6 additions and 6 deletions

View File

@ -56,7 +56,7 @@ openerp.base.core = function(openerp) {
} }
return this; return this;
} }
Class.mix = function (properties) { Class.include = function (properties) {
for (var name in properties) { for (var name in properties) {
if (typeof properties[name] !== 'function' if (typeof properties[name] !== 'function'
|| !fnTest.test(properties[name])) { || !fnTest.test(properties[name])) {

View File

@ -67,7 +67,7 @@ $(document).ready(function () {
}, },
bar: 3 bar: 3
}); });
C0.mix({ C0.include({
foo: function () { foo: function () {
return 5; return 5;
}, },
@ -94,7 +94,7 @@ $(document).ready(function () {
strictEqual(new C1().foo(), 2); strictEqual(new C1().foo(), 2);
strictEqual(new C1().bar(), 1); strictEqual(new C1().bar(), 1);
C1.mix({ C1.include({
foo: function () { return 2 + this._super(); }, foo: function () { return 2 + this._super(); },
bar: function () { return 1 + this._super(); } bar: function () { return 1 + this._super(); }
}); });
@ -110,7 +110,7 @@ $(document).ready(function () {
strictEqual(instance.foo(), 1); strictEqual(instance.foo(), 1);
strictEqual(instance.bar(), 1); strictEqual(instance.bar(), 1);
C0.mix({ C0.include({
foo: function () { return 2; }, foo: function () { return 2; },
bar: function () { return 2 + this._super(); } bar: function () { return 2 + this._super(); }
}); });
@ -128,7 +128,7 @@ $(document).ready(function () {
}); });
var instance = new C1(); var instance = new C1();
strictEqual(instance.foo(), 2); strictEqual(instance.foo(), 2);
C0.mix({ C0.include({
foo: function () { return 2; }, foo: function () { return 2; },
bar: function () { return 2 + this._super(); } bar: function () { return 2 + this._super(); }
}); });

View File

@ -88,7 +88,7 @@ initializing the addon.
/** @namespace */ /** @namespace */
openerp.example = function (openerp) { openerp.example = function (openerp) {
// basic initialization code (e.g. templates loading) // basic initialization code (e.g. templates loading)
openerp.example.SomeClass = Class.extend( openerp.example.SomeClass = openerp.base.Class.extend(
/** @lends openerp.example.SomeClass# */{ /** @lends openerp.example.SomeClass# */{
/** /**
* Description for SomeClass's constructor here * Description for SomeClass's constructor here