Class: String

Inherits:
Object
  • Object
show all
Defined in:
lib/oj/mimic.rb

Overview

More monkey patches.

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.json_create(obj) ⇒ Object


302
303
304
305
306
307
308
309
310
# File 'lib/oj/mimic.rb', line 302

def self.json_create(obj)
  s = ''
  s.encode!(Encoding::ASCII_8BIT) if s.respond_to?(:encode!)
  raw = obj['raw']
  if raw.is_a? Array
    raw.each { |v| s << v }
  end
  s
end

Instance Method Details

#to_json_rawObject


299
300
301
# File 'lib/oj/mimic.rb', line 299

def to_json_raw(*)
 to_json_raw_object().to_json()
end

#to_json_raw_objectObject


293
294
295
296
297
298
# File 'lib/oj/mimic.rb', line 293

def to_json_raw_object
  {
    JSON.create_id => self.class.name,
    'raw' => self.bytes
  }
end