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



258
259
260
261
262
263
264
265
266
# File 'lib/oj/mimic.rb', line 258

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



255
256
257
# File 'lib/oj/mimic.rb', line 255

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

#to_json_raw_objectObject



249
250
251
252
253
254
# File 'lib/oj/mimic.rb', line 249

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