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.2.11 lib/asir/coder/chain.rb
asir-1.2.10 lib/asir/coder/chain.rb
asir-1.2.9 lib/asir/coder/chain.rb
asir-1.2.8 lib/asir/coder/chain.rb
asir-1.2.7 lib/asir/coder/chain.rb
asir-1.2.6 lib/asir/coder/chain.rb
asir-1.2.5 lib/asir/coder/chain.rb
asir-1.2.3 lib/asir/coder/chain.rb
asir-1.2.2 lib/asir/coder/chain.rb
asir-1.2.1 lib/asir/coder/chain.rb
asir-1.2.0 lib/asir/coder/chain.rb
asir-1.1.12 lib/asir/coder/chain.rb
asir-1.1.11 lib/asir/coder/chain.rb
asir-1.1.10 lib/asir/coder/chain.rb
asir-1.1.9 lib/asir/coder/chain.rb
asir-1.1.8 lib/asir/coder/chain.rb
asir-1.1.7 lib/asir/coder/chain.rb
asir-1.1.6 lib/asir/coder/chain.rb
asir-1.1.5 lib/asir/coder/chain.rb
asir-1.1.4 lib/asir/coder/chain.rb