Last active
May 3, 2016 13:09
-
-
Save roryl/1209cf05ae342beeecda87dd879b0150 to your computer and use it in GitHub Desktop.
Lucee onMissingMethod 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.triggerDataMember=true; | |
} |
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 { | |
public function onMissingMethod(missingMethodName, missingMethodArguments){ | |
return arguments; | |
} | |
} |
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 { | |
public function onMissingMethod(missingMethodName, missingMethodArguments){ | |
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 { | |
public boolean function add(numeric arg1, numeric arg2){ | |
return arg1 + arg2; | |
} | |
public boolean function multiply(numeric arg1, numeric arg2){ | |
return arg1 * arg2; | |
} | |
public boolean function subtract(numeric arg1, numeric arg2){ | |
return arg1 - arg2; | |
} | |
} |
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 { | |
public function onMissingMethod(missingMethodName, missingMethodArguments){ | |
echo("You are trying to #missingMethodName# #missingMethodArguments[1]# and #missingMethodArguments[2]# <br />"); | |
var math = new math(); | |
var result = evaluate("math.#missingMethodName#(argumentCollection=missingMethodArguments)"); | |
echo("The result was #result#"); | |
} | |
} |
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 { | |
public boolean function add(numeric arg1, numeric arg2){ | |
echo("You are trying to add #arg1# and #arg2# <br />"); | |
var math = new math(); | |
var result = math.add(arg1, arg2); | |
echo("The result was #result# <br />"); | |
return arg1 + arg2; | |
} | |
public boolean function multiply(numeric arg1, numeric arg2){ | |
echo("You are trying to multiply #arg1# and #arg2# <br />"); | |
var math = new math(); | |
var result = math.add(arg1, arg2); | |
echo("The result was #result# <br />"); | |
return arg1 * arg2; | |
} | |
public boolean function subtract(numeric arg1, numeric arg2){ | |
echo("You are trying to subtract #arg1# and #arg2# <br />"); | |
var math = new math(); | |
var result = math.add(arg1, arg2); | |
echo("The result was #result# <br />"); | |
return arg1 - arg2; | |
} | |
} |
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> | |
basic = new basic().something().was().here(); | |
writeDump(basic); | |
</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> | |
dsl = new dsl().get(); | |
</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> | |
math = new mathDecorator(); | |
math.add(5, 7); | |
math.multiply(2, 10); | |
math.subtract(20, 6); | |
</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> | |
math = new mathDecoratorBasic(); | |
math.add(5, 7); | |
math.multiply(2, 10); | |
math.subtract(20, 6); | |
</cfscript> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment