Class: MagicShelf::DirStructureFlattener
- Inherits:
-
Object
- Object
- MagicShelf::DirStructureFlattener
- Defined in:
- lib/magicshelf/dirstructureflattener.rb
Instance Attribute Summary collapse
-
#workdir ⇒ Object
Returns the value of attribute workdir.
Instance Method Summary collapse
Instance Attribute Details
#workdir ⇒ Object
Returns the value of attribute workdir.
7 8 9 |
# File 'lib/magicshelf/dirstructureflattener.rb', line 7 def workdir @workdir end |
Instance Method Details
#enter ⇒ Object
8 9 10 |
# File 'lib/magicshelf/dirstructureflattener.rb', line 8 def enter() yield end |
#process ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/magicshelf/dirstructureflattener.rb', line 12 def process() @workdir ||= Dir.pwd Dir.glob(File.join(@workdir,'**/*')).select{|f|File.file?(f)}.each do |f| begin FileUtils.mv f, @workdir rescue => e MagicShelf.logger.warn(e.) end end end |