Sha256: 6557f480f2731b6d524eb9535760c038ef7bea4f4bbf393ed14a7242b3fa31a6

Contents?: true

Size: 724 Bytes

Versions: 3

Compression:

Stored size: 724 Bytes

Contents

module Basic101

  class Arguments

    attr_reader :filenames
    attr_reader :randomize
    attr_reader :transcript

    def initialize(argv)
      @transcript = false
      @randomize = true
      OptionParser.new do |opts|
        opts.banner << " [PATH]..."
        opts.on('-t', '--transcript',
                'Write transcript of input and output') do |v|
          @transcript = v
        end
        opts.on('--[no-]randomize',
                'Randomize random number generator.',
                'Default is --randomize') do |v|
          @randomize = v
        end
      end.parse!(argv)
      @filenames = argv.dup
    rescue OptionParser::ParseError => e
      $stderr.puts e
      exit 1
    end

  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
basic101-0.4.0 lib/basic101/arguments.rb
basic101-0.2.0 lib/basic101/arguments.rb
basic101-0.1.0 lib/basic101/arguments.rb