summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorlamont-granquist <lamont@scriptkiddie.org>2014-08-08 07:47:11 -0700
committerlamont-granquist <lamont@scriptkiddie.org>2014-08-08 07:47:11 -0700
commit1d7e20d6e87eccc3bef089f98551133ad0b145f2 (patch)
tree6da74b088d77bd8b95d8fee94706979b051ca4d7 /lib
parent46239c54700ad1e06a6ac86eaf0fbcb141ce3eb1 (diff)
parenta2b5da35cbeaf953779cf0877c0f212e3f1374d0 (diff)
downloadffi-yajl-1d7e20d6e87eccc3bef089f98551133ad0b145f2.tar.gz
Merge pull request #4 from opscode/lcg/json-opts
Lcg/json opts
Diffstat (limited to 'lib')
-rw-r--r--lib/ffi_yajl/encoder.rb2
-rw-r--r--lib/ffi_yajl/ffi/encoder.rb3
-rw-r--r--lib/ffi_yajl/json_gem.rb16
3 files changed, 10 insertions, 11 deletions
diff --git a/lib/ffi_yajl/encoder.rb b/lib/ffi_yajl/encoder.rb
index 8b5bfcb..bd3ff31 100644
--- a/lib/ffi_yajl/encoder.rb
+++ b/lib/ffi_yajl/encoder.rb
@@ -18,7 +18,7 @@ module FFI_Yajl
end
# call either the ext or ffi hook
- str = do_yajl_encode(obj, yajl_gen_opts)
+ str = do_yajl_encode(obj, yajl_gen_opts, opts)
str.force_encoding('UTF-8') if defined? Encoding
str
end
diff --git a/lib/ffi_yajl/ffi/encoder.rb b/lib/ffi_yajl/ffi/encoder.rb
index bbeba27..3bad69f 100644
--- a/lib/ffi_yajl/ffi/encoder.rb
+++ b/lib/ffi_yajl/ffi/encoder.rb
@@ -4,8 +4,7 @@ require 'ffi_yajl/ffi'
module FFI_Yajl
module FFI
module Encoder
- def do_yajl_encode(obj, yajl_gen_opts = {})
-
+ def do_yajl_encode(obj, yajl_gen_opts, opts)
yajl_gen = FFI_Yajl.yajl_gen_alloc(nil);
# configure the yajl encoder
diff --git a/lib/ffi_yajl/json_gem.rb b/lib/ffi_yajl/json_gem.rb
index 0e64d50..6a3b139 100644
--- a/lib/ffi_yajl/json_gem.rb
+++ b/lib/ffi_yajl/json_gem.rb
@@ -55,49 +55,49 @@ end
class Array
def to_json(*opts, &block)
- FFI_Yajl::Encoder.encode(self)
+ FFI_Yajl::Encoder.encode(self, *opts)
end
end
class Hash
def to_json(*opts, &block)
- FFI_Yajl::Encoder.encode(self)
+ FFI_Yajl::Encoder.encode(self, *opts)
end
end
class Fixnum
def to_json(*opts, &block)
- FFI_Yajl::Encoder.encode(self)
+ FFI_Yajl::Encoder.encode(self, *opts)
end
end
class Float
def to_json(*opts, &block)
- FFI_Yajl::Encoder.encode(self)
+ FFI_Yajl::Encoder.encode(self, *opts)
end
end
class String
def to_json(*opts, &block)
- FFI_Yajl::Encoder.encode(self)
+ FFI_Yajl::Encoder.encode(self, *opts)
end
end
class TrueClass
def to_json(*opts, &block)
- FFI_Yajl::Encoder.encode(self)
+ FFI_Yajl::Encoder.encode(self, *opts)
end
end
class FalseClass
def to_json(*opts, &block)
- FFI_Yajl::Encoder.encode(self)
+ FFI_Yajl::Encoder.encode(self, *opts)
end
end
class NilClass
def to_json(*opts, &block)
- FFI_Yajl::Encoder.encode(self)
+ FFI_Yajl::Encoder.encode(self, *opts)
end
end