Created
September 26, 2012 14:48
-
-
Save boughtonp/3788484 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
component | |
{ | |
function init() | |
{ | |
this.stuff = {'a a':'a','b b':'b','c c':'c'}; | |
var keys = StructKeyList(this.stuff); | |
for (var i=1; i<=listLen(keys); i++) | |
{ | |
var key = ListGetAt(keys,i); | |
this[key] = function() { return this.stuff[key]; } | |
} | |
return this; | |
} | |
} |
This file contains hidden or 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
<cfset tc = new test_closure() /> | |
<cfset s1 = tc['a a'] /> | |
<cfdump var=#s1()# /> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment