RosettaCodeData/Task/Send-an-unknown-method-call/Groovy/send-an-unknown-method-call-1.groovy
2014-01-17 05:34:36 +00:00

11 lines
210 B
Groovy

class Example {
def foo(value) {
"Invoked with '$value'"
}
}
def example = new Example()
def method = "foo"
def arg = "test value"
assert "Invoked with 'test value'" == example."$method"(arg)