summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--scripts/toy.groovy10
1 files changed, 7 insertions, 3 deletions
diff --git a/scripts/toy.groovy b/scripts/toy.groovy
index e927151..049ee56 100644
--- a/scripts/toy.groovy
+++ b/scripts/toy.groovy
@@ -238,11 +238,15 @@ def gagText = { t, p ->
def showButtonG = { s, p, t = null ->
return t != null ? showButton(gagText(s, p), t) : showButton(gagText(s, p));
};
+def compose = { texts ->
+ if (!texts || texts.isEmpty()) return null;
+ return texts.collect {
+ t -> t[getRandom(t.size())]
+ }.join(" ").capitalize();
+};
def present = { imageSpec, texts ->
if (texts) {
- show(texts.collect {
- t -> t[getRandom(t.size())]
- }.join(" ").capitalize());
+ show(compose(texts));
}
if (imageSpec) {
return showImage(imageSpec);