214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
|
# File 'ext/ffi_yajl/ext/encoder/encoder.c', line 214
def ffi_yajl(yajl_gen, state)
if state[:processing_key]
str = to_s
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_map_open(yajl_gen) ) != 0
FFI_Yajl::Encoder.raise_error_for_status(status, "{")
end
each do |key, value|
state[:processing_key] = true
key.ffi_yajl(yajl_gen, state)
state[:processing_key] = false
value.ffi_yajl(yajl_gen, state)
end
if ( status = FFI_Yajl.yajl_gen_map_close(yajl_gen) ) != 0
FFI_Yajl::Encoder.raise_error_for_status(status, "}")
end
end
end
|