Created
June 25, 2019 03:55
-
-
Save joseoliv/9325a00416fbb36b47cd1843c0548ce5 to your computer and use it in GitHub Desktop.
getProgramValueFromKey
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
package metaobjectTest | |
@doc{* | |
Annotation 'getProgramValueFromKey' is String expression. It is | |
"" if its parameter is not a program key. If it is, the expression | |
is the value associated to the key in the program but | |
transformed into a string by either method toString of Java or | |
method asString of Cyan. | |
*} | |
object GetProgramValueFromKey | |
func run { | |
/* | |
The project file, p.pyan, has the contents | |
@setVariable(debug, "yes") | |
@setVariable(author, "Jose") | |
// elided | |
program | |
// elided | |
@setVariable(test, create) | |
@setVariable(goal, "Test all metaobjects") | |
package metaobjectTest | |
// elided | |
Therefore the program variable 'debug' is associated | |
to "yes" and 'author' to "Jose". | |
*/ | |
var String value = @getProgramValueFromKey(debug); | |
assert value == "yes"; | |
value = @getProgramValueFromKey(author); | |
assert value == "Jose"; | |
} | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment