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



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

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



289
290
291
# File 'lib/oj/mimic.rb', line 289

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

#to_json_raw_objectObject



283
284
285
286
287
288
# File 'lib/oj/mimic.rb', line 283

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