From c8de2e626ea808dc847052155e4cbc2982e6fb3b Mon Sep 17 00:00:00 2001 From: Ibrahim H Date: Tue, 12 Jul 2022 16:15:14 +0100 Subject: [PATCH] Update README Tested with Groovy 3.0.7 (only some functions) --- README.md | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index c23503e..8ba8a59 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# groovy-common-extensions +# Groovy Common Extensions [![Build Status](https://travis-ci.org/timyates/groovy-common-extensions.png)](https://travis-ci.org/timyates/groovy-common-extensions) @@ -6,11 +6,19 @@ Lets you add things I find commonly useful to the Groovy language via the extens system. Obviously requires at least Groovy 2.0.5 (so that the extension system exists) +Tested under Groovy: v2.5.1, v3.0.7 Usage: @Grab( 'com.bloidonia:groovy-common-extensions:0.7.1' ) + +If you get the error `groovy.lang.GroovyRuntimeException: Conflicting module versions. Module [...`, try to exclude `groovy-all` module. + +```groovy +@GrabExclude(group='org.codehaus.groovy', module='groovy-all') +``` + and the following methods will be available to you: # Current extensions: @@ -365,12 +373,18 @@ Will pass any String through `XmlSlurper` with the specified constructor paramet ## String.toConfig - static ConfigObject toConfig( String self ) { + static ConfigObject toConfig( String self ) + Example: +```groovy assert config1.toConfig().config.a==1 +``` ## String.toJson - static Object toJson( String self ) { + static Object toJson( String self ) + Example: +```groovy assert '{"xml":{"name":"Tim"}}'.toJson().xml.name == 'Tim' +```