In case someone else stumbles upon this, I thought I would post it here:
I found the Roman numerals exercise surprisingly frustrating, not because of the task itself, but because it is set up as an extension method and it took me a fair amount of searching and reading just to figure out how to refer to the receiver value, i.e. the number to be converted.
The relevant topics appear to be covered in a combination of The Apache Groovy programming language - Runtime and compile-time metaprogramming and The Apache Groovy programming language - Closures, but even then the relevant information isn’t completely clear and I still don’t quite understand how the extension is loaded in the test. I would be grateful, however, if someone could point me to some documents that better explain the mechanism for method / property extensions in Groovy.
TL;DR: in that exercise, you can access the number to be converted either as value
(the property of Integer
that stores the actual number) or delegate
(a magic property of Groovy).