YAXML Module
YAXML Parser allows to convert YAXML files to YAML files or JSON expressions. It also permits reverse conversion, from YAML files and JSON expressions to YAXML files. This parser is based on the XML Binding for YAML proposed by YAML.org yaml.org/xml.html
This code is released under LGPL. YAXML module makes the following conversions:
* YAML -> YAXML
* JSON -> YAXML
* YAXML -> YAML
* YAXML -> JSON
And everywhere you can use a file or a string as source.
The module can be used in two ways:
1) Creating a Yaxml object
xml = Yaxml.new 'file.yml'
xml.write( $stdout, 2)
xml.to_json
xml.to_yaml
2) Using static methods of Yaxml module
xml = Yaxml::yaml2yaxml( 'file.yml' )
xml.write( $stdout, 2)
Furthermore, you can use:
xml = Yaxml::json2yaxml( { numbers: [ 1, 2, 3 ]} )
yaml = Yaxml::yaxml2yaml( 'file.yaxml' )
json = Yaxml::yaxml2json( 'file.yaxml' )
YAXML is a standalone library. It requires no other libraries. Just Ruby!
- Author
-
Diego Moreno (dmoreno AT dit.upm.es)
- License
-
GNU Lesser General Public License (aka LGPL)
Installing YAXML
You may get the latest stable version from Rubyforge.
$ gem install yaxml
Loading YAXML
You do have probably got the gem, right? To load YAXML:
require 'rubygems'
require 'yaxml'
Documentation
You can see the documentation in the project home page:
Source Code
You can clone the repository from GitHub (github.com/dmoreno/yaxml/tree/master):
# git clone [email protected]:dmoreno/yaxml.git