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-0.32.0 lib/capistrano_multiconfig_parallel/classes/input_stream.rb
capistrano_multiconfig_parallel-0.31.1 lib/capistrano_multiconfig_parallel/classes/input_stream.rb
capistrano_multiconfig_parallel-0.31.0 lib/capistrano_multiconfig_parallel/classes/input_stream.rb
capistrano_multiconfig_parallel-0.30.6 lib/capistrano_multiconfig_parallel/classes/input_stream.rb
capistrano_multiconfig_parallel-0.30.5 lib/capistrano_multiconfig_parallel/classes/input_stream.rb
capistrano_multiconfig_parallel-0.30.4 lib/capistrano_multiconfig_parallel/classes/input_stream.rb
capistrano_multiconfig_parallel-0.30.3 lib/capistrano_multiconfig_parallel/classes/input_stream.rb
capistrano_multiconfig_parallel-0.30.2 lib/capistrano_multiconfig_parallel/classes/input_stream.rb
capistrano_multiconfig_parallel-0.30.1 lib/capistrano_multiconfig_parallel/classes/input_stream.rb
capistrano_multiconfig_parallel-0.30.0 lib/capistrano_multiconfig_parallel/classes/input_stream.rb
capistrano_multiconfig_parallel-0.29.3 lib/capistrano_multiconfig_parallel/classes/input_stream.rb
capistrano_multiconfig_parallel-0.29.2 lib/capistrano_multiconfig_parallel/classes/input_stream.rb
capistrano_multiconfig_parallel-0.29.1 lib/capistrano_multiconfig_parallel/classes/input_stream.rb
capistrano_multiconfig_parallel-0.29.0 lib/capistrano_multiconfig_parallel/classes/input_stream.rb
capistrano_multiconfig_parallel-0.28.5 lib/capistrano_multiconfig_parallel/classes/input_stream.rb
capistrano_multiconfig_parallel-0.28.4 lib/capistrano_multiconfig_parallel/classes/input_stream.rb
capistrano_multiconfig_parallel-0.28.3 lib/capistrano_multiconfig_parallel/classes/input_stream.rb
capistrano_multiconfig_parallel-0.28.2 lib/capistrano_multiconfig_parallel/classes/input_stream.rb
capistrano_multiconfig_parallel-0.28.1 lib/capistrano_multiconfig_parallel/classes/input_stream.rb
capistrano_multiconfig_parallel-0.28.0 lib/capistrano_multiconfig_parallel/classes/input_stream.rb