Skip to content

Commit

Permalink
document "unwrap" option in README
Browse files Browse the repository at this point in the history
Array serialization in Gyoku confused me until I discovered savonrb#52 and
looked at the test case. This doco should help. Note it doesn't document
the further enhancement in savonrb#54,  which is not yet merged.
  • Loading branch information
mahemoff committed Dec 24, 2015
1 parent e3b7d06 commit f3dcb71
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,21 @@ Gyoku.xml("XML" => "key")
* These conventions are also applied to the return value of objects responding to :call
* All other objects are converted to Strings using :to_s

## Array values

Array items are by default wrapped with the containiner tag, which may be unexpected.

``` ruby
> Gyoku.xml({languages: [{language: 'ruby'},{language: 'java'}]})
# => "<languages><language>ruby</language></languages><languages><language>java</language></languages>"
```

You can set the `unwrap` option to remove this behavior.

``` ruby
> Gyoku.xml({languages: [{language: 'ruby'},{language: 'java'}]}, { unwrap: true})
# => "<languages><language>ruby</language><language>java</language></languages>"
```

## Special characters

Expand Down

0 comments on commit f3dcb71

Please sign in to comment.