summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorLamont Granquist <lamont@scriptkiddie.org>2017-06-21 12:26:09 -0700
committerLamont Granquist <lamont@scriptkiddie.org>2017-06-21 12:26:09 -0700
commitaa80a0441ef24dc9b6278a6ae1bb44a42d7d19de (patch)
tree7bc26f1ebb9eefecfd39cbf0b0a97058138ad156 /lib
parentf703608a13bf85a22eb39020a0fcb3dbc10a8a0b (diff)
downloadffi-yajl-aa80a0441ef24dc9b6278a6ae1bb44a42d7d19de.tar.gz
remove duplicated code
Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
Diffstat (limited to 'lib')
-rw-r--r--lib/ffi_yajl/ffi/encoder.rb20
1 files changed, 1 insertions, 19 deletions
diff --git a/lib/ffi_yajl/ffi/encoder.rb b/lib/ffi_yajl/ffi/encoder.rb
index f35f3c4..62b2c96 100644
--- a/lib/ffi_yajl/ffi/encoder.rb
+++ b/lib/ffi_yajl/ffi/encoder.rb
@@ -1,5 +1,5 @@
# Copyright (c) 2015 Lamont Granquist
-# Copyright (c) 2015 Chef Software, Inc.
+# Copyright (c) 2015-2017, Chef Software Inc.
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
@@ -166,24 +166,6 @@ class Integer
FFI_Yajl::Encoder.raise_error_for_status(status, str)
end
else
- if ( status = FFI_Yajl.yajl_gen_integer(yajl_gen, self) ) != 0
- FFI_Yajl::Encoder.raise_error_for_status(status, str)
- end
- end
- end
-end
-
-class Integer
- def ffi_yajl(yajl_gen, state)
- str = to_s
- if str == "NaN" || str == "Infinity" || str == "-Infinity"
- raise ::FFI_Yajl::EncodeError, "'#{str}' is an invalid number"
- end
- if state[:processing_key]
- if ( status = FFI_Yajl.yajl_gen_string(yajl_gen, str, str.bytesize) ) != 0
- FFI_Yajl::Encoder.raise_error_for_status(status, str)
- end
- else
if ( status = FFI_Yajl.yajl_gen_number(yajl_gen, str, str.bytesize) ) != 0
FFI_Yajl::Encoder.raise_error_for_status(status, str)
end