Class: Object
- Inherits:
- BasicObject
- Defined in:
- lib/ffi_yajl/ffi/encoder.rb,
lib/ffi_yajl/json_gem.rb
Overview
I feel dirty
Instance Method Summary collapse
Instance Method Details
#ffi_yajl(rb_yajl_gen, state) ⇒ Object
271 272 273 274 275 276 277 278 279 280 281 282 283 |
# File 'ext/ffi_yajl/ext/encoder/encoder.c', line 271 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 str = self.to_s status = FFI_Yajl.yajl_gen_string(yajl_gen, str, str.bytesize) end if ( status ) != 0 FFI_Yajl::Encoder.raise_error_for_status(status) end end |
#to_json(*args, &block) ⇒ Object
134 135 136 |
# File 'lib/ffi_yajl/json_gem.rb', line 134 def to_json(*args, &block) "\"#{to_s}\"" end |