Groovy web console

subscribe to the feed Subscribe
to this
site
Uh oh (via #groovywebconsole)
tweet this snippet Tweet
this
script

Uh oh

Published 2 months ago by md
Actions  ➤ Edit in console Back to console Show/hide line numbers View recent scripts
class Book { String title }  

String.metaClass.toUpperCase = {-> reverse() }  
Book.metaClass.titleInUpperCase << {-> title.toUpperCase() }  

def b = new Book(title:"The Stand")  

assert "THE STAND" == b.titleInUpperCase()