Module: CommandKit::CombinedIO::Prepended

Defined in:
lib/command_kit/combined_io.rb

Overview

Prepends run to open file arguments (or stdin) as IO streams.

Instance Method Summary collapse

Instance Method Details

#run(*args) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
# File 'lib/command_kit/combined_io.rb', line 15

def run(*args)
  args << "-" if args.empty?

  ios = args.map { |readable| self.open(readable) }

  begin
    super(*ios)
  ensure
    ios.each(&:close)
  end
end