Class: Tagmv::PrunePath
- Inherits:
-
Object
- Object
- Tagmv::PrunePath
- Defined in:
- lib/tagmv/prune_path.rb
Instance Attribute Summary collapse
-
#path ⇒ Object
readonly
Returns the value of attribute path.
Class Method Summary collapse
Instance Method Summary collapse
- #empty_dir? ⇒ Boolean
-
#initialize(path) ⇒ PrunePath
constructor
A new instance of PrunePath.
- #rmdir ⇒ Object
- #tag_dir? ⇒ Boolean
Constructor Details
#initialize(path) ⇒ PrunePath
Returns a new instance of PrunePath.
4 5 6 |
# File 'lib/tagmv/prune_path.rb', line 4 def initialize(path) @path = path end |
Instance Attribute Details
#path ⇒ Object (readonly)
Returns the value of attribute path.
3 4 5 |
# File 'lib/tagmv/prune_path.rb', line 3 def path @path end |
Class Method Details
Instance Method Details
#empty_dir? ⇒ Boolean
12 13 14 |
# File 'lib/tagmv/prune_path.rb', line 12 def empty_dir? FileTest.directory?(path) && Dir.entries(path) == ['.', '..'] end |
#rmdir ⇒ Object
16 17 18 |
# File 'lib/tagmv/prune_path.rb', line 16 def rmdir Dir.rmdir(path) if tag_dir? && empty_dir? end |
#tag_dir? ⇒ Boolean
8 9 10 |
# File 'lib/tagmv/prune_path.rb', line 8 def tag_dir? path =~ /..-$/ && path !~ Tagmv::Tree.false_tag_regex end |