Sha256: 5163f14da710b1adb7ceca866b323024a24b0dc07ef131b30bd05661b2b38c95

Contents?: true

Size: 552 Bytes

Versions: 31

Compression:

Stored size: 552 Bytes

Contents

module ASIR
  class Coder
    # !SLIDE
    # Chain Coder
    # Chain multiple Coders as one.
    #
    # @@@ text
    # message  --> | e1 | --> | e2 | --> | eN | -->
    # result   <-- | d1 | <-- | d2 | <-- | dN | <--
    # @@@
    class Chain < self
      attr_accessor :encoders

      def _encode obj
        encoders.each do | e |
          obj = e.dup.encode(obj)
        end
        obj
      end

      def _decode obj
        encoders.reverse_each do | e |
          obj = e.dup.decode(obj)
        end
        obj
      end
    end
  end
end

Version data entries

31 entries across 31 versions & 1 rubygems

Version Path
asir-1.1.3 lib/asir/coder/chain.rb
asir-1.1.2 lib/asir/coder/chain.rb
asir-1.1.1 lib/asir/coder/chain.rb
asir-1.1.0 lib/asir/coder/chain.rb
asir-1.0.8 lib/asir/coder/chain.rb
asir-1.0.7 lib/asir/coder/chain.rb
asir-1.0.6 lib/asir/coder/chain.rb
asir-1.0.5 lib/asir/coder/chain.rb
asir-1.0.4 lib/asir/coder/chain.rb
asir-1.0.1 lib/asir/coder/chain.rb
asir-0.2.0 lib/asir/coder/chain.rb