summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authortyler-ball <tyleraball@gmail.com>2014-10-07 14:01:39 -0700
committertyler-ball <tyleraball@gmail.com>2014-10-07 14:01:39 -0700
commitd713d2681aba154fc83d41b32bbdbb99c2055b61 (patch)
tree41e85ca3d6b4dfa79b63c0d31f07116b8f141a18 /lib
parent31df485a023364383353dabb97f9f0609ceddde6 (diff)
downloadffi-yajl-d713d2681aba154fc83d41b32bbdbb99c2055b61.tar.gz
Cleaning up code - letting yajl do more heavy lifting for us. Also removing version change since that will occur during release.
Diffstat (limited to 'lib')
-rw-r--r--lib/ffi_yajl/ffi/encoder.rb7
-rw-r--r--lib/ffi_yajl/version.rb2
2 files changed, 6 insertions, 3 deletions
diff --git a/lib/ffi_yajl/ffi/encoder.rb b/lib/ffi_yajl/ffi/encoder.rb
index 3724e49..8177f5f 100644
--- a/lib/ffi_yajl/ffi/encoder.rb
+++ b/lib/ffi_yajl/ffi/encoder.rb
@@ -203,10 +203,13 @@ class Object
def ffi_yajl(yajl_gen, state)
if self.respond_to?(:to_json)
json = self.to_json(state[:json_opts])
+ # #yajl_gen_number outputs a string without quotes around it
+ status = FFI_Yajl.yajl_gen_number(yajl_gen, json, json.bytesize)
else
- json = "\"#{to_s}\""
+ str = self.to_s
+ status = FFI_Yajl.yajl_gen_string(yajl_gen, str, str.bytesize)
end
- if ( status = FFI_Yajl.yajl_gen_number(yajl_gen, json, json.bytesize) ) != 0
+ if ( status ) != 0
FFI_Yajl::Encoder.raise_error_for_status(status)
end
end
diff --git a/lib/ffi_yajl/version.rb b/lib/ffi_yajl/version.rb
index b175d87..2f55c2b 100644
--- a/lib/ffi_yajl/version.rb
+++ b/lib/ffi_yajl/version.rb
@@ -1,3 +1,3 @@
module FFI_Yajl
- VERSION = "1.1.1"
+ VERSION = "1.1.0"
end