Skip to content

Commit

Permalink
updating files for 0.5.7 release
Browse files Browse the repository at this point in the history
  • Loading branch information
brianmario committed Jun 24, 2009
1 parent 8603763 commit 66dbfd5
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 4 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
@@ -1,5 +1,11 @@
# Changelog # Changelog


## 0.5.7 (June 23rd, 2009)
* You can now pass parser options (like :symbolize_keys for example) to Yajl::HttpStream.get
* Refactored spec tests a bit, DRYing up the Yajl::HttpStream specs quite a bit.
* Added a spec rake task, and spec.opts file
* Updated and renamed rcov rake task, and added rcov.opts file

## 0.5.6 (June 19th, 2009) ## 0.5.6 (June 19th, 2009)
* Added JSON.default_options hash to the JSON gem compatibility API * Added JSON.default_options hash to the JSON gem compatibility API
* Split out the JSON gem compatibility API's parsing and encoding methods into individually includable files * Split out the JSON gem compatibility API's parsing and encoding methods into individually includable files
Expand Down
8 changes: 7 additions & 1 deletion README.rdoc
Expand Up @@ -102,12 +102,16 @@ Since yajl-ruby parses JSON as a stream, supporting API's like Twitter's Streami
You can simply supply a block to Yajl::HttpStream.get, which is used as the callback for when a JSON object has been You can simply supply a block to Yajl::HttpStream.get, which is used as the callback for when a JSON object has been
unserialized off the stream. For the case of this Twitter Streaming API call, the callback gets fired a few times a second (depending on your connection speed). unserialized off the stream. For the case of this Twitter Streaming API call, the callback gets fired a few times a second (depending on your connection speed).
The code below is all that's needed to make the request and stream unserialized Ruby hashes off the response, continuously. The code below is all that's needed to make the request and stream unserialized Ruby hashes off the response, continuously.
You'll note that I've enabled the :symbolize_keys parser option as well. Doing so is much more efficient for parsing JSON streams with
lots of repetitive keys - for things like result sets or multiple API requests - than the same parse with string keys.
This is because Ruby will reuse (and never GC) it's symbol table. Be that as it may, if you want to parse JSON strings with random key names
it's much better to leave string keys enabled (the default), so they can get GC'd later.


require 'uri' require 'uri'
require 'yajl/http_stream' require 'yajl/http_stream'


uri = URI.parse("http://#{username}:#{password}@stream.twitter.com/spritzer.json") uri = URI.parse("http://#{username}:#{password}@stream.twitter.com/spritzer.json")
Yajl::HttpStream.get(uri) do |hash| Yajl::HttpStream.get(uri, :symbolize_keys => true) do |hash|
puts hash.inspect puts hash.inspect
end end


Expand Down Expand Up @@ -252,6 +256,8 @@ This project includes code from the BSD licensed yajl project, copyright 2007-20


== Special Thanks == Special Thanks


For those of you using yajl-ruby out in the wild, please hit me up on Twitter (brianmario) or send me a message here on the Githubs describing the site and how you're using it. I'd love to get a list going!

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! 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!! * Lloyd Hilaiel - http://github.com/lloyd - for writing Yajl!!
Expand Down
2 changes: 1 addition & 1 deletion lib/yajl.rb
Expand Up @@ -13,7 +13,7 @@
# #
# Ruby bindings to the excellent Yajl (Yet Another JSON Parser) ANSI C library. # Ruby bindings to the excellent Yajl (Yet Another JSON Parser) ANSI C library.
module Yajl module Yajl
VERSION = "0.5.6" VERSION = "0.5.7"


class Parser class Parser
# A helper method for parse-and-forget use-cases # A helper method for parse-and-forget use-cases
Expand Down
4 changes: 2 additions & 2 deletions yajl-ruby.gemspec
Expand Up @@ -2,11 +2,11 @@


Gem::Specification.new do |s| Gem::Specification.new do |s|
s.name = %q{yajl-ruby} s.name = %q{yajl-ruby}
s.version = "0.5.6" s.version = "0.5.7"


s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version= s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["Brian Lopez", "Lloyd Hilaiel"] s.authors = ["Brian Lopez", "Lloyd Hilaiel"]
s.date = %q{2009-06-22} s.date = %q{2009-06-23}
s.email = %q{seniorlopez@gmail.com} s.email = %q{seniorlopez@gmail.com}
s.extensions = ["ext/extconf.rb"] s.extensions = ["ext/extconf.rb"]
s.extra_rdoc_files = [ s.extra_rdoc_files = [
Expand Down

0 comments on commit 66dbfd5

Please sign in to comment.