Class: RakeDocker::Container::Destroyer

Inherits:
Object
  • Object
show all
Includes:
Utilities
Defined in:
lib/rake_docker/container.rb

Overview

rubocop:enable Metrics/ClassLength

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Utilities

#enhance_with_name, #find_container

Constructor Details

#initialize(name, opts = {}) ⇒ Destroyer

Returns a new instance of Destroyer.



276
277
278
279
# File 'lib/rake_docker/container.rb', line 276

def initialize(name, opts = {})
  @name = name
  @reporter = opts[:reporter] || NullReporter.new
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



274
275
276
# File 'lib/rake_docker/container.rb', line 274

def name
  @name
end

#reporterObject (readonly)

Returns the value of attribute reporter.



274
275
276
# File 'lib/rake_docker/container.rb', line 274

def reporter
  @reporter
end

Instance Method Details

#executeObject



281
282
283
284
285
286
287
288
289
290
291
# File 'lib/rake_docker/container.rb', line 281

def execute
  reporter.checking_if_container_exists(name)
  container = find_container(name)
  if container
    reporter.container_exists(container)
    destroy_container(container)
  else
    reporter.container_does_not_exist(name)
  end
  reporter.done
end