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.7.2 lib/capistrano_multiconfig_parallel/classes/input_stream.rb
capistrano_multiconfig_parallel-1.7.1 lib/capistrano_multiconfig_parallel/classes/input_stream.rb
capistrano_multiconfig_parallel-1.7.0 lib/capistrano_multiconfig_parallel/classes/input_stream.rb
capistrano_multiconfig_parallel-1.6.0 lib/capistrano_multiconfig_parallel/classes/input_stream.rb
capistrano_multiconfig_parallel-1.5.2 lib/capistrano_multiconfig_parallel/classes/input_stream.rb
capistrano_multiconfig_parallel-1.5.1 lib/capistrano_multiconfig_parallel/classes/input_stream.rb
capistrano_multiconfig_parallel-1.5.0 lib/capistrano_multiconfig_parallel/classes/input_stream.rb
capistrano_multiconfig_parallel-1.4.2 lib/capistrano_multiconfig_parallel/classes/input_stream.rb
capistrano_multiconfig_parallel-1.4.1 lib/capistrano_multiconfig_parallel/classes/input_stream.rb
capistrano_multiconfig_parallel-1.4.0 lib/capistrano_multiconfig_parallel/classes/input_stream.rb
capistrano_multiconfig_parallel-1.3.1 lib/capistrano_multiconfig_parallel/classes/input_stream.rb
capistrano_multiconfig_parallel-1.3.0 lib/capistrano_multiconfig_parallel/classes/input_stream.rb
capistrano_multiconfig_parallel-1.2.9 lib/capistrano_multiconfig_parallel/classes/input_stream.rb
capistrano_multiconfig_parallel-1.2.8 lib/capistrano_multiconfig_parallel/classes/input_stream.rb
capistrano_multiconfig_parallel-1.2.7 lib/capistrano_multiconfig_parallel/classes/input_stream.rb
capistrano_multiconfig_parallel-1.2.6 lib/capistrano_multiconfig_parallel/classes/input_stream.rb
capistrano_multiconfig_parallel-1.2.5 lib/capistrano_multiconfig_parallel/classes/input_stream.rb
capistrano_multiconfig_parallel-1.2.4 lib/capistrano_multiconfig_parallel/classes/input_stream.rb
capistrano_multiconfig_parallel-1.2.3 lib/capistrano_multiconfig_parallel/classes/input_stream.rb
capistrano_multiconfig_parallel-1.2.2 lib/capistrano_multiconfig_parallel/classes/input_stream.rb