Sha256: 7bad8b8779c3f84f9dbd55367cf14b3574434b1ea4b32ae26f1114e2eed96f06

Contents?: true

Size: 560 Bytes

Versions: 1

Compression:

Stored size: 560 Bytes

Contents

require 'optparse'
require 'dimsum'

include Dimsum

options = {}

OptionParser.new do |opts|
  opts.banner = "Usage: sample.rb [options]"
  opts.on("-n [Fixnum]", "--number [Fixnum]", "") do |n|
    options[:lines] = n
  end
end.parse!

options[:lines] ||= "5"

lines = options[:lines].to_i

reservoir_sample = if ARGV.length > 0
                     filename = ARGV[0]
                     reservoir_file(filename, lines)
                   else
                     reservoir_stdin(lines)
                   end

reservoir_sample.each{ |l| STDOUT.print l }

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
dimsum-0.0.2 bin/dimsum