Sha256: 86e67dd8bbc23824bf95783a0f784f2e1ba2bfb65664140a73b1bcdc3211fcdf
Contents?: true
Size: 402 Bytes
Versions: 22
Compression:
Stored size: 402 Bytes
Contents
# A parallel WordCount. Depends on the 'wc' utility. class WordCount < CloudCrowd::Action # Count the words in a single book. # Pretend that this takes longer than it really does, for demonstration purposes. def process sleep 5 (`wc -w #{input_path}`).match(/\A\s*(\d+)/)[1].to_i end # Sum the total word count. def merge input.inject(0) {|sum, count| sum + count } end end
Version data entries
22 entries across 22 versions & 2 rubygems