Class: Hidden
- Inherits:
-
Object
- Object
- Hidden
- Includes:
- SanitizePlugin
- Defined in:
- lib/what_cd/sanitize_plugins/hidden.rb
Instance Method Summary collapse
-
#initialize ⇒ Hidden
constructor
A new instance of Hidden.
- #sanitize(context) ⇒ Object
Constructor Details
#initialize ⇒ Hidden
Returns a new instance of Hidden.
10 11 12 13 14 15 16 17 18 |
# File 'lib/what_cd/sanitize_plugins/hidden.rb', line 10 def initialize @log = Logging.logger[self] @log.appenders = Logging.appenders.stdout if $verbose @log.level = :debug else @log.level = :info end end |
Instance Method Details
#sanitize(context) ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/what_cd/sanitize_plugins/hidden.rb', line 20 def sanitize(context) path = context[:path] Dir.entries(path).each do |entry| # We only want to remove hidden files... not directories. ASK ME HOW I KNOW! if !File.directory? entry # Remove hidden files if entry.start_with? "." @log.debug "Deleting hidden file #{path + entry}" FileUtils.rm_rf(path + entry) end end end return context end |