diff --git a/wc.rb b/wc.rb index f0a3474..8b16a82 100644 --- a/wc.rb +++ b/wc.rb @@ -24,12 +24,11 @@ def count_file_stats(input) end def process_input(source) - input = if source == '-' - $stdin.read - else - File.read(source) - end - count_file_stats(input) + if source == '-' + count_file_stats(ARGF) + else + count_file_stats(File.read(source)) + end end def update_totals(totals, stats)