Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
wlandau
committed
Aug 16, 2014
1 parent
b413b3f
commit d25222c
Showing
2 changed files
with
18 additions
and
20 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,23 @@ | ||
;(function(){ | ||
ATC = function(args){ | ||
|
||
/* Load all arguments. */ | ||
|
||
if(args !== undefined) | ||
for(key in args) | ||
this[key] = args[key]; | ||
|
||
/* Constructors are capitalized methods. */ | ||
|
||
var isConstructor = function(method){ | ||
return method[0] === method[0].toUpperCase(); | ||
} | ||
|
||
/* Create new objects from all constructors if not given as arguments. */ | ||
}; | ||
|
||
this.configure = function(args){ | ||
if(args !== undefined) | ||
for(key in args) | ||
this[key] = args[key]; | ||
|
||
for(obj in this) | ||
if(isConstructor(obj)){ | ||
var instance = obj.charAt(0).toLowerCase() + obj.slice(1); | ||
if(!this.hasOwnProperty(instance)) | ||
this[instance] = new this[obj](); | ||
} | ||
for(obj in this) | ||
if(isConstructor(obj)){ | ||
var instance = obj.charAt(0).toLowerCase() + obj.slice(1); | ||
if(!this.hasOwnProperty(instance)) | ||
this[instance] = new this[obj](); | ||
} | ||
}; | ||
|
||
this.configure(args); | ||
}; | ||
})(undefined); |
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