Sha256: b726574c01f2fab8aa2b419181302b5f0f2c1370c5573768f8aeb3bf41872539

Contents?: true

Size: 321 Bytes

Versions: 5

Compression:

Stored size: 321 Bytes

Contents

# frozen_string_literal: true

module Paquito
  class AllowNil
    def initialize(coder)
      @coder = Paquito.cast(coder)
    end

    def dump(object)
      return nil if object.nil?
      @coder.dump(object)
    end

    def load(payload)
      return nil if payload.nil?
      @coder.load(payload)
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
paquito-0.3.1 lib/paquito/allow_nil.rb
paquito-0.3.0 lib/paquito/allow_nil.rb
paquito-0.2.1 lib/paquito/allow_nil.rb
paquito-0.2.0 lib/paquito/allow_nil.rb
paquito-0.1.0 lib/paquito/allow_nil.rb