Created
June 30, 2010 06:41
-
-
Save canonic-epicure/458325 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require.paths.unshift('/home/nickolay/Playground/nodejs'); | |
require('Task/Joose/NodeJS'); | |
var sys = require('sys'); | |
Joose.Module('SuperStuff', { | |
require : [ 'faye'], | |
use : [ 'Task/JooseX/Class/SimpleConstructor/Core', 'Task/JooseX/Role/Parameterized/Core', 'JooseX/Class/Singleton' ], | |
body : function (m) { | |
Joose.Role('MyFirstParamd', { | |
meta : JooseX.Role.Parameterized, | |
parameter : { | |
methodsMatching : null | |
}, | |
introspect : true, | |
role : function (self, consumer) { | |
var role = { | |
override : {} | |
} | |
consumer.meta.getMethods().each(function (method, name) { | |
if (self.methodsMatching.test(name)) { | |
role.override[ name ] = function () { | |
sys.puts('this is incredible') | |
// this.SUPERARG(arguments) | |
sys.puts('I set it with the dollar sign thing') | |
} | |
} | |
}) | |
return role | |
} | |
}) | |
Joose.Class('WillParam', { | |
trait : JooseX.Class.SimpleConstructor, | |
does : SuperStuff['MyFirstParamd']({ methodsMatching : /^bob$/ }), | |
// does : SuperStuff['MyFirstParamd']({ methodsMatching : /^.+\$(.+)\$(WOWZERS)$/ }), | |
has : { | |
things : { is : 'rw', init : 'someText' } | |
}, | |
methods : { | |
bob : function (val) { | |
this.setThings(val); | |
} | |
} | |
}) | |
SuperStuff['myVar'] = SuperStuff['WillParam'](); | |
sys.puts(SuperStuff['myVar'].getThings()); | |
SuperStuff['myVar'].bob() | |
} | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment