Skip to content

Commit

Permalink
- aliased 'my' into the containing class's prototype
Browse files Browse the repository at this point in the history
  • Loading branch information
canonic-epicure committed Nov 20, 2009
1 parent edb6c17 commit ec7c7c9
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
2 changes: 2 additions & 0 deletions lib/Joose/Managed/My.js
Expand Up @@ -20,6 +20,8 @@ Joose.Managed.My = new Joose.Managed.Role('Joose.Managed.My', {
myExtend.body = function (createdClass) {
me.c.my = isRole ? createdClass : new createdClass({ targetMeta : me })

me.c.prototype.my = me.c.my

if (myExtendBody) myExtendBody.call(this, createdClass)
}

Expand Down
2 changes: 2 additions & 0 deletions lib/Task/Joose/Core.js
Expand Up @@ -2577,6 +2577,8 @@ Joose.Managed.My = new Joose.Managed.Role('Joose.Managed.My', {
myExtend.body = function (createdClass) {
me.c.my = isRole ? createdClass : new createdClass({ targetMeta : me })

me.c.prototype.my = me.c.my

if (myExtendBody) myExtendBody.call(this, createdClass)
}

Expand Down
6 changes: 5 additions & 1 deletion t/040_my_symbiont.t.js
@@ -1,5 +1,6 @@
StartTest(function (t) {
t.plan(38)

t.plan(40)

//==================================================================================================================================================================================
t.diag("Symbiont - separate, built-in class, (analog of class-methods + class-attributes + class-roles + ...)")
Expand Down Expand Up @@ -52,6 +53,9 @@ StartTest(function (t) {
t.ok(TestClass.my.res == 'class', "Symbiont's attribute was correctly installed")
t.is(TestClass.my.result(), 'TestClass:class', "Symbiont's method was correctly installed")

t.ok(testClass.my.res == 'class', "Symbiont is also accesible via 'my' in prototype")
t.is(testClass.my.result(), 'TestClass:class', "... indeed")


//==================================================================================================================================================================================
t.diag("Role with symbiont creation")
Expand Down

0 comments on commit ec7c7c9

Please sign in to comment.