mercredi 8 juin 2016

Where to integrate the code

I m pasting a code below in which I have detected what does it do but unable to paste it in appropriate files. I am new to Ruby. Can anyone please help me where to paste which chunk of code.

def capture_stdout
  stdout = $stdout.dup
  Tempfile.open 'stdout-redirect' do |temp|
    $stdout.reopen temp.path, 'w+'
    yield if block_given?
    $stdout.reopen stdout
    temp.read
  end
end

captured_content = capture_stdout do
  system("ls -al #{Scheduler.last.shared_path}/data/pipelines/ ")
end


puts "#{captured_content}"

Aucun commentaire:

Enregistrer un commentaire