This comes from the Venkat DSL screencast. Not that you can’t type yourself, but it shows a different way to do a DSL than most people think about
thePlayers = [:]
def players(String[] args) {
args.each {player ->
thePlayers[player] = 0
}
}
def getPrint_dice() {
thePlayers.each {player, dice ->
println “${player} rolled ${dice}”
}
}
def invokeMethod(String name, args) {
thePlayers[name] = args[0]
}
players ‘tim’, ‘brian’, ‘barry’
tim 5
brian 3
barry 4
print_dice