How is STDERR.puts different from puts in Ruby? -


i'm learning language programming ruby 1.9, , toss stderr.puts block of code in book without explaining why they're using or how it's different puts.

i've googled , wikied term, can gather research it's involved in diagnostics. in code provided programming ruby there seem link error exception handling.

here's code.

require_relative 'csv_reader' reader = csvreader.new argv.each |csv_file_name|   stderr.puts "processing #{csv_file_name}"   reader.read_in_csv_data(csv_file_name) end 

i did manage read somewhere stderr.puts used error handling out of convention, guess i'm asking if acts differently puts.

by default, puts writes stdout. specifying stderr.puts, you're sending output stderr handle. although implementation behavior same, using stderr instead of stdout impact consumers of program, since attempting capture output program stdout, convention. best practice log debugging information, errors, warnings, status, etc stderr , actual program output stdout.


Comments

Popular posts from this blog

php - SPIP: From Tag directly to an article -

jquery - isAjaxRequest always return false -

ruby on rails - In a controller spec, how to find a specific tag in the generated view? -