Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update README #20

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 17 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,24 @@
# 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)

Lets you add things I find commonly useful to the Groovy language via the extension
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:
Expand Down Expand Up @@ -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'
```