getProgramValueFromKey
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