Class: Decidim::Exporters::JSON
- Defined in:
 - lib/decidim/exporters/json.rb
 
Overview
Exports a JSON version of a provided hash, given a collection and a Serializer.
Instance Method Summary collapse
- 
  
    
      #export  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
Public: Generates a JSON representation of a collection and a Serializer.
 
Methods inherited from Exporter
Constructor Details
This class inherits a constructor from Decidim::Exporters::Exporter
Instance Method Details
#export ⇒ Object
Public: Generates a JSON representation of a collection and a Serializer.
Returns an ExportData with the export.
      14 15 16 17 18 19 20  | 
    
      # File 'lib/decidim/exporters/json.rb', line 14 def export data = ::JSON.pretty_generate(@collection.map do |resource| @serializer.new(resource).run end) ExportData.new(data, "json") end  |