Class: Pbmenv::DestroyVersionService
- Inherits:
-
Object
- Object
- Pbmenv::DestroyVersionService
- Defined in:
- lib/pbmenv/services/destroy_version_service.rb
Defined Under Namespace
Classes: VersionNotFoundError
Instance Attribute Summary collapse
-
#version ⇒ Object
Returns the value of attribute version.
Instance Method Summary collapse
- #execute! ⇒ Object
-
#initialize(version:) ⇒ DestroyVersionService
constructor
A new instance of DestroyVersionService.
Constructor Details
#initialize(version:) ⇒ DestroyVersionService
Returns a new instance of DestroyVersionService.
9 10 11 |
# File 'lib/pbmenv/services/destroy_version_service.rb', line 9 def initialize(version: ) @version = version end |
Instance Attribute Details
#version ⇒ Object
Returns the value of attribute version.
7 8 9 |
# File 'lib/pbmenv/services/destroy_version_service.rb', line 7 def version @version end |
Instance Method Details
#execute! ⇒ Object
13 14 15 16 17 18 19 20 |
# File 'lib/pbmenv/services/destroy_version_service.rb', line 13 def execute! version_pathname = VersionPathname.new(version) unless File.exist?(version_pathname.version_path) raise VersionNotFoundError end Helper.system_and_puts "rm -rf #{version_pathname.version_path}" end |