Class: Expire::Commands::Remove
- Inherits:
-
Expire::Command
- Object
- Expire::Command
- Expire::Commands::Remove
- Defined in:
- lib/expire/commands/remove.rb
Overview
Remove files and directories
Instance Attribute Summary collapse
-
#path ⇒ Object
readonly
Returns the value of attribute path.
Instance Method Summary collapse
- #execute(output: $stdout) ⇒ Object
-
#initialize(path:) ⇒ Remove
constructor
A new instance of Remove.
Methods inherited from Expire::Command
#command, #cursor, #editor, #exec_exist?, #generator, #pager, #platform, #prompt, #screen, #which
Constructor Details
#initialize(path:) ⇒ Remove
Returns a new instance of Remove.
9 10 11 |
# File 'lib/expire/commands/remove.rb', line 9 def initialize(path:) @path = path end |
Instance Attribute Details
#path ⇒ Object (readonly)
Returns the value of attribute path.
13 14 15 |
# File 'lib/expire/commands/remove.rb', line 13 def path @path end |
Instance Method Details
#execute(output: $stdout) ⇒ Object
15 16 17 18 19 20 21 22 23 |
# File 'lib/expire/commands/remove.rb', line 15 def execute(output: $stdout) begin Expire.remove(path) rescue Errno::ENOENT => e output.puts "can't remove #{path}: #{e}" exit 1 end output.puts "removed #{path}" end |