Sha256: 72fa312487cb67e195957c5715b0b5dea320c1b23cf6a14b7bdcf31a5fa0fe30
Contents?: true
Size: 456 Bytes
Versions: 3
Compression:
Stored size: 456 Bytes
Contents
# frozen_string_literal: true module Paquito class CoderChain def initialize(*coders) @coders = coders.flatten.map { |c| Paquito.cast(c) } @reverse_coders = @coders.reverse end def dump(object) payload = object @coders.each { |c| payload = c.dump(payload) } payload end def load(payload) object = payload @reverse_coders.each { |c| object = c.load(object) } object end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
paquito-0.11.2 | lib/paquito/coder_chain.rb |
paquito-0.11.1 | lib/paquito/coder_chain.rb |
paquito-0.11.0 | lib/paquito/coder_chain.rb |