Sha256: accf6909c68f48e6d3e27270eabf900403b28e37055d97ea110a30078e7885e7
Contents?: true
Size: 827 Bytes
Versions: 1
Compression:
Stored size: 827 Bytes
Contents
module Downer class Options < Hash attr_reader :opts, :orig_args def initialize(args) @opts = args.clone self[:is_website] = false self[:images_only] = false @opts = OptionParser.new do |o| o.banner = "Usage: downer -flags URL_SOURCE DESTINATION_DIR" o.on('-w', '--web', 'Declare source as a url') do |url| self[:is_website] = true end o.on('-i', '--image', 'When combined with w will download JPG,GIF,PNG formats') do self[:images_only] = true end 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
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
downer-0.3.0 | lib/downer/options.rb |