Class: Percheron::Actions::Purge

Inherits:
Object
  • Object
show all
Includes:
Base
Defined in:
lib/percheron/actions/purge.rb

Instance Method Summary collapse

Methods included from Base

#base_dir, #in_working_directory

Constructor Details

#initialize(unit, force: false) ⇒ Purge

Returns a new instance of Purge.



6
7
8
9
# File 'lib/percheron/actions/purge.rb', line 6

def initialize(unit, force: false)
  @unit = unit
  @force = force
end

Instance Method Details

#execute!Object



11
12
13
14
15
16
17
# File 'lib/percheron/actions/purge.rb', line 11

def execute!
  results = []
  results << stop!
  results << delete_unit!  if delete_unit?
  results << delete_image! if delete_image?
  results.compact.empty? ? nil : unit
end