Skip to content

Instantly share code, notes, and snippets.

@chirino
Forked from jstrachan/gist:2036040
Created March 14, 2012 12:09
Show Gist options
  • Save chirino/2036056 to your computer and use it in GitHub Desktop.
Save chirino/2036056 to your computer and use it in GitHub Desktop.
Tuple3 {
inline def forEach(fn: Function<Any?,Unit>):Unit = {
fn.invoke(this._1)
fn.invoke(this._2)
fn.invoke(this._3)
}
}
StringTemplate3 : Tuple3 {
fun toString = {
val sb = StringBuilder();
this.forEach{ sb.append(it) }
sb.toString
}
}
fun StringTemplate3.toHtml(options:Options) = {
val sb = HtmlBuilder(options);
this.forEach{ sb.append(it) }
sb.toString
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment