class Tagmv::PrunePath

Attributes

path[R]

Public Class Methods

new(path) click to toggle source
# File lib/tagmv/prune_path.rb, line 4
def initialize(path)
  @path = path
end
prune_tag_dirs() click to toggle source
# File lib/tagmv/prune_path.rb, line 20
def self.prune_tag_dirs
  Find.find(Tagmv::Filesystem.root).reverse_each do |path|
    Tagmv::PrunePath.new(path).rmdir
  end
end

Public Instance Methods

empty_dir?() click to toggle source
# File lib/tagmv/prune_path.rb, line 12
def empty_dir?
  FileTest.directory?(path) && Dir.entries(path) == ['.', '..']
end
rmdir() click to toggle source
# File lib/tagmv/prune_path.rb, line 16
def rmdir
  Dir.rmdir(path) if tag_dir? && empty_dir?
end
tag_dir?() click to toggle source
# File lib/tagmv/prune_path.rb, line 8
def tag_dir?
  path =~ /..-$/ && path !~ Tagmv::Tree.false_tag_regex
end