From 3e8b029d8e739ea72d13b899d1c4b02b058b955d Mon Sep 17 00:00:00 2001 From: Rikuoh Tsujitani Date: Fri, 19 Jul 2024 14:57:01 +0900 Subject: [PATCH] =?UTF-8?q?AGRF=E3=82=921=E5=9B=9E=E3=81=AE=E3=81=BF?= =?UTF-8?q?=E4=BD=BF=E3=81=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- wc.rb | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) 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)