Class: Downloads::Commands::Add

Inherits:
Base
  • Object
show all
Defined in:
lib/downloads/commands/add.rb

Instance Attribute Summary collapse

Attributes inherited from Base

#configuration, #local, #options, #remote

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

command_name, inherited, #initialize, #usage

Constructor Details

This class inherits a constructor from Downloads::Commands::Base

Instance Attribute Details

#urisObject

Returns the value of attribute uris.



6
7
8
# File 'lib/downloads/commands/add.rb', line 6

def uris
  @uris
end

Class Method Details

.usageObject



8
9
10
# File 'lib/downloads/commands/add.rb', line 8

def self.usage
  "#{super} URL ..."
end

Instance Method Details

#configure(argv) ⇒ Object



12
13
14
15
16
17
# File 'lib/downloads/commands/add.rb', line 12

def configure(argv)
  self.uris = []
  while uri = shift_argument(argv)
    self.uris << parse_uri(uri)
  end
end

#runObject



19
20
21
# File 'lib/downloads/commands/add.rb', line 19

def run
  remote.run("wget '#{uris.join("' '")}' --no-check-certificate")
end

#valid?Boolean

Returns:

  • (Boolean)


23
24
25
# File 'lib/downloads/commands/add.rb', line 23

def valid?
  uris.any?
end