Class: Fuckery::Commands::Delete
- Inherits:
-
Object
- Object
- Fuckery::Commands::Delete
- Defined in:
- lib/fuckery/commands/delete.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
- #directory ⇒ Object
- #directory_exists? ⇒ Boolean
- #execute ⇒ Object
-
#initialize(name) ⇒ Delete
constructor
A new instance of Delete.
Constructor Details
#initialize(name) ⇒ Delete
Returns a new instance of Delete.
6 7 8 |
# File 'lib/fuckery/commands/delete.rb', line 6 def initialize(name) @name = name end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
4 5 6 |
# File 'lib/fuckery/commands/delete.rb', line 4 def name @name end |
Instance Method Details
#directory ⇒ Object
22 23 24 |
# File 'lib/fuckery/commands/delete.rb', line 22 def directory Fuckery.fuckery_directory(name) end |
#directory_exists? ⇒ Boolean
18 19 20 |
# File 'lib/fuckery/commands/delete.rb', line 18 def directory_exists? Dir.exists? directory end |
#execute ⇒ Object
10 11 12 13 14 15 16 |
# File 'lib/fuckery/commands/delete.rb', line 10 def execute if directory_exists? FileUtils.rm_rf directory else raise DoesNotExistError.new("#{name.inspect} is not currently a fuckery (check your spelling)") end end |