Sha256: c1388639f152475e4ea2f5e89140c87dd8006e20075023b47a8c88166f115cce

Contents?: true

Size: 542 Bytes

Versions: 3

Compression:

Stored size: 542 Bytes

Contents

module CapistranoMulticonfigParallel
  # class used to find application dependencies
  class Helper
    # rubocop:disable Lint/Eval
    def self.capture(stream)
      stream = stream.to_s
      captured_stream = Tempfile.new(stream)
      stream_io = eval("$#{stream}")
      origin_stream = stream_io.dup
      stream_io.reopen(captured_stream)

      yield

      stream_io.rewind
      return captured_stream.read
    ensure
      captured_stream.close
      captured_stream.unlink
      stream_io.reopen(origin_stream)
    end
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
capistrano_multiconfig_parallel-0.6.3 lib/capistrano_multiconfig_parallel/initializers/helper.rb
capistrano_multiconfig_parallel-0.6.2 lib/capistrano_multiconfig_parallel/initializers/helper.rb
capistrano_multiconfig_parallel-0.6.1 lib/capistrano_multiconfig_parallel/initializers/helper.rb