Method: Code::Object.code_to_json

Defined in:
lib/code/object.rb

.code_to_json(pretty: nil) ⇒ Object



245
246
247
248
249
250
251
# File 'lib/code/object.rb', line 245

def self.code_to_json(pretty: nil)
  if Boolean.new(pretty).truthy?
    String.new(::JSON.pretty_generate(self))
  else
    String.new(to_json)
  end
end