openfoodfoundation/openfoodnetwork

View on GitHub
engines/dfc_provider/app/services/dfc_io.rb

Summary

Maintainability
A
0 mins
Test Coverage
# frozen_string_literal: true

# Our interface to the DFC Connector library.
module DfcIo
  # Serialise DFC Connector subjects as JSON-LD string.
  def self.export(*subjects)
    return "" if subjects.empty?

    DfcLoader.connector.export(*subjects)
  end

  def self.import(json_string_or_io)
    DfcLoader.connector.import(json_string_or_io)
  end
end