Last active
April 22, 2016 12:50
-
-
Save roryl/2a50bde54f70683747f0353926d49179 to your computer and use it in GitHub Desktop.
Lucee Mixin Examples
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
component { | |
} |
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
component { | |
include template="mixin.cfm"; | |
this.lastFunc = new mixinComponent().lastFunc; | |
variables.lastFunc = new mixinComponent().lastFunc; | |
} |
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
component { | |
function init(){ | |
//Do something on instantiation | |
return this; | |
} | |
} |
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
component { | |
include template="mixin.cfm" | |
function init(){ | |
//Do something on instantiation | |
return this; | |
} | |
} |
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
interface { | |
public function myOtherFunc(required array myArray){ | |
} | |
public function thirdFunc(required string myString){ | |
} | |
} |
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
interface { | |
public function lastFunc(required array myArray){ | |
} | |
} |
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
component extends="baseComponent" implements="IMixin"{ | |
function init(){ | |
//Do something on instantiation | |
return this; | |
} | |
function myFunc(){ | |
} | |
} |
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
component { | |
mixinComponent = new mixinComponent(); | |
this.fourthFunc = mixinComponent.fourthFunc; | |
variables.fourthFunc = mixinComponent.fourthFunc; | |
this.fifthFunc = mixinComponent.fifthFunc; | |
variables.fifthFunc = mixinComponent.fifthFunc; | |
function init(){ | |
//Do something on instantiation | |
return this; | |
} | |
} |
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
<cfscript> | |
function myOtherFunc(required array myArray){ | |
} | |
function thirdFunc(required string myString){ | |
} | |
</cfscript> |
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
<cfscript> | |
public function lastFunc(required array myArray){ | |
} | |
</cfscript> |
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
component { | |
function fourthFunc(){ | |
} | |
function fifthFunc(){ | |
} | |
public function lastFunc(required array myArray){ | |
} | |
} |
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
/** | |
* My xUnit Test | |
*/ | |
component extends="testbox.system.BaseSpec"{ | |
/*********************************** LIFE CYCLE Methods ***********************************/ | |
// executes before all test cases | |
function beforeTests(){ | |
} | |
// executes after all test cases | |
function afterTests(){ | |
} | |
// executes before every test case | |
function setup( currentMethod ){ | |
} | |
// executes after every test case | |
function teardown( currentMethod ){ | |
} | |
/*********************************** TEST CASES BELOW ***********************************/ | |
// Remember that test cases MUST start or end with the keyword 'test' | |
function mixingTest(){ | |
myObj = new implementsComponent(); | |
writeDump(getMetaData(myObj)); | |
} | |
// Remember that test cases MUST start or end with the keyword 'test' | |
function basicComponentTest(){ | |
myObj = new basicComponent(); | |
writeDump(myObj); | |
} | |
// Remember that test cases MUST start or end with the keyword 'test' | |
function basicMixinTest(){ | |
myObj = new basicMixin(); | |
writeDump(myObj); | |
} | |
// Remember that test cases MUST start or end with the keyword 'test' | |
function liftTest(){ | |
myObj = new liftComponent(); | |
writeDump(myObj); | |
} | |
// Remember that test cases MUST start or end with the keyword 'test' | |
function interfaceTest(){ | |
myObj = new implementsComponent(); | |
writeDump(myObj); | |
writeDump(getMetaData(myObj)); | |
} | |
} |
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
component { | |
function universalFunctionality(){ | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment