README.rdoc in brianmario-yajl-ruby-0.4.6 vs README.rdoc in brianmario-yajl-ruby-0.4.7
- old
+ new
@@ -2,28 +2,36 @@
This gem (although not in gem form just yet) is a C binding to the excellent YAJL JSON parsing and generation library.
You can read more info at the projects website http://lloydforge.org/projects/yajl or check out it's codes at http://github.com/lloyd/yajl.
+== How to install
+
+Install it like any other gem hosted at the Githubs like so:
+
+(more instructions here: http://gems.github.com)
+
+ sudo gem install brianmario-yajl-ruby
+
== Example of use
-First, you're probably gonna want to include it:
+First, you're probably gonna want to require it:
- include 'yajl'
+ require 'yajl'
=== Parsing
Then maybe parse some JSON from:
a File IO
- json_contents = File.new('test.json', 'r')
+ json = File.new('test.json', 'r')
hash = Yajl::Stream.parse(json)
or maybe a StringIO
- json_contents = StringIO.new
+ json = StringIO.new
hash = Yajl::Stream.parse(json)
or maybe STDIN
cat someJsonFile.json | ruby -ryajl -e "puts Yajl::Stream.parse(STDIN).inspect"
@@ -102,29 +110,18 @@
There are a lot more possibilities, some of which I'm going to write other gems/plugins for.
Some ideas are:
* parsing logs in JSON format
-* an ActiveSupport patch (http://github.com/technoweenie/rails/commit/f9abcc93a3660fcf46172c4cd8a2f36ba5a5510d)
+* a Rails plugin (http://github.com/technoweenie/yajl-rails)
+* builtin Rails 3 support?
* Rack middleware (ideally the JSON body could be handed to the parser while it's still being received)
* use with ohai
* JSON API clients
* Patch Marshal#load and Marshal#dump to use JSON? ;)
* etc...
-== How to install
-
-First, Yajl uses CMake to build itself (yes, the author realizes this isn't the norm for open source and is willing and ready to accept patches, fork away kids!) so you'll need to grab it first from http://www.cmake.org.
-
-After you've got that, grab the latest version (I suggest at least 1.0.4 as it contains fixes for Unicode parsing) of Yajl itself from the Githubs at http://github.com/lloyd/yajl.
-
-After you have that installed, you should be able to install it like any other gem hosted here like so:
-
-(more instructions here: http://gems.github.com)
-
- sudo gem install brianmario-yajl-ruby
-
== Benchmarks
After I finished implementation - this library performs close to the same as the current JSON.parse (C gem) does on small/medium files.
But on larger files, and higher amounts of iteration, this library was around 2x faster than JSON.parse.
@@ -174,15 +171,20 @@
* Yajl::Stream.encode: 3.47s
* JSON#to_json: 6.6s
* YAML.dump(obj, io): 1309.93s
+== Third Party Sources Bundled
+
+This project includes code from the BSD licensed yajl project, copyright 2007-2009 Lloyd Hilaiel
+
== Special Thanks
I've had a lot of inspiration, and a lot of help. Thanks to everyone who's been a part of this and those to come!
-* Lloyd Hilaiel (http://github.com/lloyd) - for writing Yajl!!
-* Josh Ferguson (http://github.com/besquared) - for peer-pressuring me into getting back into C; it worked ;) Also tons of support over IM
-* Jonathan Novak (http://github.com/cypriss) - pointer-hacking help
-* Tom Smith (http://github.com/rtomsmith) - pointer-hacking help
-* Rick (http://github.com/technoweenie) - for making an ActiveSupport patch with support for this library and teasing me that it might go into Rails 3. You sure lit a fire under my ass and I got a ton of work done because of it! :)
-* The entire Github Crew - my inspiration, time spent writing this, finding Yajl, So many-MANY other things wouldn't have been possible without this awesome service. I owe you guys some whiskey at Kilowatt.
+* Lloyd Hilaiel - http://github.com/lloyd - for writing Yajl!!
+* Josh Ferguson - http://github.com/besquared - for peer-pressuring me into getting back into C; it worked ;) Also tons of support over IM
+* Jonathan Novak - http://github.com/cypriss - pointer-hacking help
+* Tom Smith - http://github.com/rtomsmith - pointer-hacking help
+* Rick http://github.com/technoweenie - for making an ActiveSupport patch with support for this library and teasing me that it might go into Rails 3. You sure lit a fire under my ass and I got a ton of work done because of it! :)
+* The entire Github Crew - http://github.com/ - my inspiration, time spent writing this, finding Yajl, So many-MANY other things wouldn't have been possible without this awesome service. I owe you guys some whiskey at Kilowatt.
+* benburkert - http://github.com/benburkert
\ No newline at end of file