Class: Rubcask::Task::CleanDirectory
- Inherits:
-
Object
- Object
- Rubcask::Task::CleanDirectory
- Defined in:
- lib/rubcask/task/clean_directory.rb
Overview
Removes all files marked as executable in the directory
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(directory) ⇒ CleanDirectory
constructor
A new instance of CleanDirectory.
Constructor Details
#initialize(directory) ⇒ CleanDirectory
Returns a new instance of CleanDirectory.
7 8 9 |
# File 'lib/rubcask/task/clean_directory.rb', line 7 def initialize(directory) @directory = directory end |
Instance Method Details
#call ⇒ Object
11 12 13 14 15 16 |
# File 'lib/rubcask/task/clean_directory.rb', line 11 def call Dir.glob(["*.data", "*.hint"].map! { |ext| File.join(@directory, ext) }).each do |file| next unless File.executable?(file) File.delete(file) end end |