Sha256: ffff2201ede1e5f1197db4bade9d77dba276adb2d90ac8e2838efa716686ee30

Contents?: true

Size: 511 Bytes

Versions: 9

Compression:

Stored size: 511 Bytes

Contents

module Pallets
  module Serializers
    class Base
      def dump(data)
        raise NotImplementedError
      end

      def load(data)
        raise NotImplementedError
      end

      alias_method :dump_job, :dump
      alias_method :load_job, :load

      # Context hashes only need their values (de)serialized
      def dump_context(data)
        data.map { |k, v| [k.to_s, dump(v)] }.to_h
      end

      def load_context(data)
        data.map { |k, v| [k, load(v)] }.to_h
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
pallets-0.11.0 lib/pallets/serializers/base.rb
pallets-0.10.0 lib/pallets/serializers/base.rb
pallets-0.9.0 lib/pallets/serializers/base.rb
pallets-0.8.0 lib/pallets/serializers/base.rb
pallets-0.7.0 lib/pallets/serializers/base.rb
pallets-0.6.0 lib/pallets/serializers/base.rb
pallets-0.5.1 lib/pallets/serializers/base.rb
pallets-0.5.0 lib/pallets/serializers/base.rb
pallets-0.4.0 lib/pallets/serializers/base.rb