Sha256: 9dc30d919f1407c674e7b394f24a62ea0675928aa2c861903ec979b5bd680c1b
Contents?: true
Size: 788 Bytes
Versions: 4
Compression:
Stored size: 788 Bytes
Contents
module MakeExportable #:nodoc: class JSON < ExportableFormat #:nodoc: self.reference = :json self.name = "JSON" self.register_format attr_accessor :data_set, :data_headers def initialize(data_set, data_headers=[]) self.long = "JavaScript Object Notation (JSON)" self.mime_type = "application/json; charset=utf-8;" self.data_set = data_set self.data_headers = data_headers end def generate output = [] unless data_headers.blank? data_set.each do |row| h = {} row.each_with_index do |field, i| h[data_headers[i]] = field end output << h end else end return output.to_json end def sanitize(value) end end end
Version data entries
4 entries across 4 versions & 1 rubygems