diff options
author | Lamont Granquist <lamont@scriptkiddie.org> | 2014-06-15 10:58:10 -0700 |
---|---|---|
committer | Lamont Granquist <lamont@scriptkiddie.org> | 2014-06-15 10:58:10 -0700 |
commit | 569b650532e0ef3eab0b29f43cb2c47f47577b9d (patch) | |
tree | d0b21077cc559e9697b450be9e1f7d5aa7c9b435 | |
parent | aa71fe4777d2667696e420f7ea15326cfbb45aa8 (diff) | |
download | ffi-yajl-569b650532e0ef3eab0b29f43cb2c47f47577b9d.tar.gz |
handle StringIOs by being slurpy for now
-rw-r--r-- | lib/ffi_yajl/parser.rb | 4 | ||||
-rw-r--r-- | spec/ffi_yajl/parser_spec.rb | 1 |
2 files changed, 4 insertions, 1 deletions
diff --git a/lib/ffi_yajl/parser.rb b/lib/ffi_yajl/parser.rb index 0f44477..d095011 100644 --- a/lib/ffi_yajl/parser.rb +++ b/lib/ffi_yajl/parser.rb @@ -50,6 +50,10 @@ module FFI_Yajl # XXX: bug-compat with ruby-yajl return nil if str == "" + if str.respond_to?(:read) + str = str.read() + end + # call either the ext or ffi hook do_yajl_parse(str, yajl_opts) end diff --git a/spec/ffi_yajl/parser_spec.rb b/spec/ffi_yajl/parser_spec.rb index c3424ef..f896bf7 100644 --- a/spec/ffi_yajl/parser_spec.rb +++ b/spec/ffi_yajl/parser_spec.rb @@ -150,7 +150,6 @@ describe "FFI_Yajl::Parser" do let(:json) { StringIO.new('{"key": 1234}') } it "should parse" do - skip "handle StringIOs" expect(parser).to eq({"key" => 1234}) end end |