Sha256: 68bd35c4e5af72ac4eefbdbd7c5d78d5b1db51eaafee67df10f65b504f914a3d

Contents?: true

Size: 671 Bytes

Versions: 4

Compression:

Stored size: 671 Bytes

Contents

require 'deadly_serious/engine/channel/socket_channel'
require 'deadly_serious/engine/channel/file_channel'
require 'deadly_serious/engine/channel/pipe_channel'

module DeadlySerious
  module Engine

    CHANNELS = [SocketChannel, FileChannel, PipeChannel]

    # Fake class, it's actually a factory ¬¬
    #
    # name = '>xxx'     # File
    # name = 'xxx'      # Pipe
    # name = 'xxx:999'  # Socket
    # name = '!xxx:999' # 0MQueue
    module Channel
      def self.new(name, config)
        of_type(name).new(name, config)
      end

      def self.of_type(name)
        CHANNELS.map { |channel| channel.of_type(name) }.compact.first
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
deadly_serious-2.0.0.pre.rc4 lib/deadly_serious/engine/channel.rb
deadly_serious-2.0.0.pre.rc3 lib/deadly_serious/engine/channel.rb
deadly_serious-2.0.0.pre.rc2 lib/deadly_serious/engine/channel.rb
deadly_serious-2.0.0.pre.rc1 lib/deadly_serious/engine/channel.rb