wc
This commit is contained in:
parent
b712e9bf5f
commit
b0d547fda0
1 changed files with 14 additions and 10 deletions
14
wc.rb
14
wc.rb
|
@ -58,16 +58,20 @@ def print_total(total_stats, max_widths, options)
|
|||
puts "#{total_result} 合計"
|
||||
end
|
||||
|
||||
options, input_sources = parse_options
|
||||
total_stats = [0, 0, 0]
|
||||
max_widths = [0, 0, 0]
|
||||
def process_input_sources(input_sources, options)
|
||||
total_stats = [0, 0, 0]
|
||||
max_widths = [0, 0, 0]
|
||||
|
||||
input_sources.each do |source|
|
||||
input_sources.each do |source|
|
||||
stats = process_input(source)
|
||||
total_stats = update_totals(total_stats, stats)
|
||||
max_widths = update_max_widths(max_widths, stats)
|
||||
result = format_result(stats, max_widths, options)
|
||||
print_result(result, source)
|
||||
end
|
||||
|
||||
print_total(total_stats, max_widths, options) if input_sources.size > 1
|
||||
end
|
||||
|
||||
print_total(total_stats, max_widths, options) if input_sources.size > 1
|
||||
options, input_sources = parse_options
|
||||
process_input_sources(input_sources, options)
|
||||
|
|
Loading…
Reference in a new issue