Class: Downloads::Commands::Rm

Inherits:
Base
  • Object
show all
Defined in:
lib/downloads/commands/rm.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

#filenamesObject

Returns the value of attribute filenames.



4
5
6
# File 'lib/downloads/commands/rm.rb', line 4

def filenames
  @filenames
end

Class Method Details

.usageObject



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

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

Instance Method Details

#configure(argv) ⇒ Object



10
11
12
13
14
15
# File 'lib/downloads/commands/rm.rb', line 10

def configure(argv)
  self.filenames = []
  while filename = shift_argument(argv)
    self.filenames << filename
  end
end

#runObject



17
18
19
# File 'lib/downloads/commands/rm.rb', line 17

def run
  remote.run("rm '#{filenames.join("' '")}'")
end

#valid?Boolean

Returns:

  • (Boolean)


21
22
23
# File 'lib/downloads/commands/rm.rb', line 21

def valid?
  filenames.any?
end