Sha256: c5c7d4d0685d4318ebc65f0c9eb734c092ce47c2b13630f5f596dc7834fcff5e

Contents?: true

Size: 748 Bytes

Versions: 116

Compression:

Stored size: 748 Bytes

Contents

module CapistranoMulticonfigParallel
  # class used to hook into the input stream
  class InputStream
    def self.hook(actor, stringio)
      $stdin = new($stdin, actor, stringio)
    end

    def self.unhook
      $stdin.finish if $stdin.is_a? CapistranoMulticonfigParallel::InputStream
      $stdin = STDIN
    end

    attr_accessor :real, :actor, :stringio

    def initialize(real_stdin, actor, stringio)
      self.real = real_stdin
      self.actor = actor
      self.stringio = stringio
    end

    def gets(*_args)
      @stringio.rewind
      data = @stringio.read
      @actor.user_prompt_needed?(data)
    end

    def finish
    end

    def method_missing(name, *args, &block)
      @real.send name, *args, &block
    end
  end
end

Version data entries

116 entries across 116 versions & 1 rubygems

Version Path
capistrano_multiconfig_parallel-1.2.1 lib/capistrano_multiconfig_parallel/classes/input_stream.rb
capistrano_multiconfig_parallel-1.2.0 lib/capistrano_multiconfig_parallel/classes/input_stream.rb
capistrano_multiconfig_parallel-1.1.9 lib/capistrano_multiconfig_parallel/classes/input_stream.rb
capistrano_multiconfig_parallel-1.1.8 lib/capistrano_multiconfig_parallel/classes/input_stream.rb
capistrano_multiconfig_parallel-1.1.7 lib/capistrano_multiconfig_parallel/classes/input_stream.rb
capistrano_multiconfig_parallel-1.1.6 lib/capistrano_multiconfig_parallel/classes/input_stream.rb
capistrano_multiconfig_parallel-1.1.5 lib/capistrano_multiconfig_parallel/classes/input_stream.rb
capistrano_multiconfig_parallel-1.1.4 lib/capistrano_multiconfig_parallel/classes/input_stream.rb
capistrano_multiconfig_parallel-1.1.3 lib/capistrano_multiconfig_parallel/classes/input_stream.rb
capistrano_multiconfig_parallel-1.1.2 lib/capistrano_multiconfig_parallel/classes/input_stream.rb
capistrano_multiconfig_parallel-1.1.1 lib/capistrano_multiconfig_parallel/classes/input_stream.rb
capistrano_multiconfig_parallel-1.1.0 lib/capistrano_multiconfig_parallel/classes/input_stream.rb
capistrano_multiconfig_parallel-1.0.7 lib/capistrano_multiconfig_parallel/classes/input_stream.rb
capistrano_multiconfig_parallel-1.0.6 lib/capistrano_multiconfig_parallel/classes/input_stream.rb
capistrano_multiconfig_parallel-1.0.5 lib/capistrano_multiconfig_parallel/classes/input_stream.rb
capistrano_multiconfig_parallel-1.0.4 lib/capistrano_multiconfig_parallel/classes/input_stream.rb
capistrano_multiconfig_parallel-1.0.3 lib/capistrano_multiconfig_parallel/classes/input_stream.rb
capistrano_multiconfig_parallel-1.0.2 lib/capistrano_multiconfig_parallel/classes/input_stream.rb
capistrano_multiconfig_parallel-1.0.1 lib/capistrano_multiconfig_parallel/classes/input_stream.rb
capistrano_multiconfig_parallel-1.0.0 lib/capistrano_multiconfig_parallel/classes/input_stream.rb