Please sign in to comment.
- Loading branch information...
Showing with 12 additions and 40 deletions.
|@@ -1,25 +0,0 @@|
|-<?xml version="1.0" encoding="UTF-8"?>|
|- <title>Json-lib::JRuby integration</title>|
|- <section name="Using Json-lib with JRuby">|
|- <p><center><a href="http://jruby.codehaus.org"><img src="images/logos/jruby-logo.png"/></a></center></p>|
|- <p>Since version 2.0 Json-lib has integrated <a href="http://jruby.codehaus.org">JRuby</a> support, meaning that you can take advantge of the library's Java and XML support. There are other features as well:<ul>|
|-<li>JSONObject supports the leftShift (<<) operator to append values, the following rules apply:<ul>|
|-<li>If the shifted arg is a Map, it will call putAll() on the object.</li>|
|-<li>If the shifted arg is a List and its size == 2, the first element will be the key, and the second will be the value.</li>|
|-<li>If the shifted arg is a List and its size > 2, the first element will be the key, the arg will be shifted by 1 and passed as the value (will create a JSONArray because it is a List).</li>|
|-<li>Any other type will be discarded, the object will not be affected nor an exception will be thrown.</li>|
|-<li>JSONObject and JSONarray implement java.util.Comparable, which enables the use of the comparison operators with them.</li>|
|-<li>JSONObject implements java.util.Map and JSONArray implements java.util.List, anything you can do with Maps and List can be done with JSONObject and JSONArray.</li>|
|-<li>JSONObject.empty? and JSONArray.empty? provide rubylicious shortcuts to isEmpty().</li>|