Method: WPM#stats
- Defined in:
- lib/wpm.rb
#stats ⇒ Object
89 90 91 92 93 94 |
# File 'lib/wpm.rb', line 89 def stats str=File.open(wpm_file).read scores=str.split(" ").map(&:to_i).select.with_index{|e,i| i.odd?} puts "Number of races: #{str.count("\n")}" puts "Average speed: #{scores.average}WPM" end |