Groovy web console

subscribe to the feed Subscribe
to this
site
I am a foolish man (via #groovywebconsole)
tweet this snippet Tweet
this
script

I am a foolish man

Published 3 months ago by bob
Actions  ➤ Edit in console Back to console Show/hide line numbers View recent scripts
String takeString(String message) {
  assert message instanceof String    
  return message }

webhooks = [staging: 'foo', production: 'bar'] 
var = 'staging'
key = var
println "your hook is ${webhooks.get(key)}"
 
notKey = "${var}"
println "your hook is ${webhooks.get(notKey)}"

notKey2 = takeString("${var}")
println "your hook is ${webhooks.get(notKey2)}"