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


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

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


287
288
289
# File 'lib/oj/mimic.rb', line 287

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

#to_json_raw_objectObject


281
282
283
284
285
286
# File 'lib/oj/mimic.rb', line 281

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