Sha256: 1e82de6405bf317a29d8fbfb39bbeaedd955e4c48494973f7279ce159ecb4c66

Contents?: true

Size: 563 Bytes

Versions: 1

Compression:

Stored size: 563 Bytes

Contents

module Parse
  module Db
    class Import

      def map_arrays_to_strings(record)
        record.each { |k, v| record[k] = v.join(', ') if v.is_a? Array }
      end

      def klass_from_file(file)
        class_name = File.basename(File.dirname(file))
        get_class(class_name)
      end

      def process_parse_file(file, &block)
        IO.foreach(file) do |record|
          record = JSON.parse(record)
          record = map_arrays_to_strings(record)
          next if record["delete"]
          yield(record)
        end
      end

    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
parse-db-import-0.0.1 lib/parse/db/import/utils.rb