Sha256: 03ac21056e3144072fcccbb3b765f4d9d0d27f3974b5a39fbc3c27bd58ab2777

Contents?: true

Size: 498 Bytes

Versions: 2

Compression:

Stored size: 498 Bytes

Contents

module Downer
  class Options < Hash
    attr_reader :opts, :orig_args
    
    def initialize(args)
      
      @orig_args = args.clone
      @opts = OptionParser.new do |o|
        o.banner = "Usage: downer URL_SOURCE DESTINATION_DIR"
      end
      
      begin
        @opts.parse!(args)
        self[:file_manifest] = args.shift
        self[:target_directory] = args.shift
      rescue OptionParser::InvalidOption => e
        self[:invalid_argument] = e.message
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
downer-0.2.2 lib/downer/options.rb
downer-0.1.1 lib/downer/options.rb