Sha256: ad12847bc92081e85aad158f10c6565ac6181518d8c2fc04568df561bce04cf1

Contents?: true

Size: 784 Bytes

Versions: 15

Compression:

Stored size: 784 Bytes

Contents

module EventMachine
  class SystemCommand
    module PipeHandler
      def self.included(base)
        base.extend(ClassMethods)
      end

      def attach_pipe_handler name, io_object
        EM.attach(io_object, pipe_handler_class(name), self, name)
      end

      def pipe_handler_class name
        self.class.pipe_handlers[name]
      end

      module ClassMethods
        def pipe_handler name, klass
          pipe_handlers[name] = klass
        end

        def pipe_handler_class name
          pipe_handlers[name]
        end

        def pipe_handlers
          @pipe_handlers ||= {
            stdin:  EM::SystemCommand::Pipe,
            stdout: EM::SystemCommand::Pipe,
            stderr: EM::SystemCommand::Pipe
          }
        end
      end
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
em-systemcommand-2.0.10 lib/em-systemcommand/pipe_handler.rb
em-systemcommand-2.0.9 lib/em-systemcommand/pipe_handler.rb
em-systemcommand-2.0.8 lib/em-systemcommand/pipe_handler.rb
em-systemcommand-2.0.6 lib/em-systemcommand/pipe_handler.rb
em-systemcommand-2.0.5 lib/em-systemcommand/pipe_handler.rb
em-systemcommand-2.0.4 lib/em-systemcommand/pipe_handler.rb
em-systemcommand-2.0.3 lib/em-systemcommand/pipe_handler.rb
em-systemcommand-2.0.2 lib/em-systemcommand/pipe_handler.rb
em-systemcommand-2.0.1 lib/em-systemcommand/pipe_handler.rb
em-systemcommand-2.0.0 lib/em-systemcommand/pipe_handler.rb
em-systemcommand-1.2.0 lib/em-systemcommand/pipe_handler.rb
em-systemcommand-1.1.2 lib/em-systemcommand/pipe_handler.rb
em-systemcommand-1.0.2 lib/em-systemcommand/pipe_handler.rb
em-systemcommand-1.0.1 lib/em-systemcommand/pipe_handler.rb
em-systemcommand-1.0.0 lib/em-systemcommand/pipe_handler.rb