aboutsummaryrefslogblamecommitdiffstats
path: root/activesupport/lib/active_support/json/encoders/object.rb
blob: 9cc12d91acb1381d2c4bc248852dd83043c76426 (plain) (tree)
1
2
3
4
5
6
7
8
9

                                                           
            
                                                                                      
                            
                                             
     
 
         

                                                        
       
   
require 'active_support/core_ext/object/instance_variables'

class Object
  # Dumps object in JSON (JavaScript Object Notation). See www.json.org for more info.
  def to_json(options = nil)
    ActiveSupport::JSON.encode(self, options)
  end

  private
    def rails_to_json(*args)
      ActiveSupport::JSON.encode(instance_values, *args)
    end
end