diff options
author | Lamont Granquist <lamont@scriptkiddie.org> | 2015-07-09 08:39:40 -0700 |
---|---|---|
committer | Lamont Granquist <lamont@scriptkiddie.org> | 2015-07-09 08:39:40 -0700 |
commit | 8fabdd3fddbd222109976fddb0d38255a9490f1d (patch) | |
tree | 05c37181d228a244809572d16e3f2dfe2733fd90 /lib/ffi_yajl/ffi/parser.rb | |
parent | 6d427a893b28ee71ddcdbb3a6cd64cd01c7a690f (diff) | |
download | ffi-yajl-8fabdd3fddbd222109976fddb0d38255a9490f1d.tar.gz |
fix lots of cops
and add a few more to be ignored
Diffstat (limited to 'lib/ffi_yajl/ffi/parser.rb')
-rw-r--r-- | lib/ffi_yajl/ffi/parser.rb | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/lib/ffi_yajl/ffi/parser.rb b/lib/ffi_yajl/ffi/parser.rb index 77d2389..d0d152a 100644 --- a/lib/ffi_yajl/ffi/parser.rb +++ b/lib/ffi_yajl/ffi/parser.rb @@ -23,7 +23,6 @@ module FFI_Yajl module FFI module Parser - def set_value(val) case stack.last when Hash @@ -50,10 +49,9 @@ module FFI_Yajl end def key_pop - @key = key_stack.pop() + @key = key_stack.pop end - def setup_callbacks @null_callback = ::FFI::Function.new(:int, [:pointer]) do |ctx| set_value(nil) @@ -68,7 +66,7 @@ module FFI_Yajl 1 end @number_callback = ::FFI::Function.new(:int, [:pointer, :string, :size_t ]) do |ctx, stringval, stringlen| - s = stringval.slice(0,stringlen) + s = stringval.slice(0, stringlen) s.force_encoding('UTF-8') if defined? Encoding # XXX: I can't think of a better way to do this right now. need to call to_f if and only if its a float. v = ( s =~ /[\.eE]/ ) ? s.to_f : s.to_i @@ -80,7 +78,7 @@ module FFI_Yajl 1 end @string_callback = ::FFI::Function.new(:int, [:pointer, :string, :size_t]) do |ctx, stringval, stringlen| - s = stringval.slice(0,stringlen) + s = stringval.slice(0, stringlen) s.force_encoding('UTF-8') if defined? Encoding set_value(s) 1 @@ -91,7 +89,7 @@ module FFI_Yajl 1 end @map_key_callback = ::FFI::Function.new(:int, [:pointer, :string, :size_t]) do |ctx, key, keylen| - s = key.slice(0,keylen) + s = key.slice(0, keylen) s.force_encoding('UTF-8') if defined? Encoding self.key = @opts[:symbolize_keys] ? s.to_sym : s 1 @@ -113,7 +111,6 @@ module FFI_Yajl end end - def do_yajl_parse(str, yajl_opts = {}) setup_callbacks callback_ptr = ::FFI::MemoryPointer.new(::FFI_Yajl::YajlCallbacks) |