Sha256: 1fea6415eebba928d23b2d933ab357b085e148e2d57143667a15e9954924af5d

Contents?: true

Size: 1.39 KB

Versions: 2

Compression:

Stored size: 1.39 KB

Contents

# frozen_string_literal: true

require "digest/md5"
require "bigdecimal"
require "date"
require "set"
require "yaml"

require "msgpack"

require "paquito/version"
require "paquito/deflater"
require "paquito/compressor"
require "paquito/allow_nil"
require "paquito/translate_errors"
require "paquito/safe_yaml"
require "paquito/conditional_compressor"
require "paquito/single_byte_prefix_version"
require "paquito/single_byte_prefix_version_with_string_bypass"
require "paquito/comment_prefix_version"
require "paquito/types"
require "paquito/codec_factory"
require "paquito/struct"
require "paquito/typed_struct"
require "paquito/serialized_column"

module Paquito
  autoload :CacheEntryCoder, "paquito/cache_entry_coder"
  autoload :FlatCacheEntryCoder, "paquito/flat_cache_entry_coder"
  autoload :ActiveRecordCoder, "paquito/active_record_coder"

  class << self
    def cast(coder)
      if coder.respond_to?(:load) && coder.respond_to?(:dump)
        coder
      elsif coder.respond_to?(:deflate) && coder.respond_to?(:inflate)
        Deflater.new(coder)
      elsif coder.respond_to?(:compress) && coder.respond_to?(:decompress)
        Compressor.new(coder)
      else
        raise TypeError, "Coders must respond to #dump and #load, #{coder.inspect} doesn't"
      end
    end

    def chain(*coders)
      CoderChain.new(*coders)
    end

    def allow_nil(coder)
      AllowNil.new(coder)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
paquito-0.9.2 lib/paquito.rb
paquito-0.9.1 lib/paquito.rb