Module: Filander::Inside
Instance Method Summary collapse
Methods included from Base
#create_directory_for, #entries, #join_destination, #join_source, #report, #with_report
Instance Method Details
#inside(source, destination = source, &block) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/filander/actions/inside.rb', line 5 def inside(source, destination = source, &block) dest_dir = join_destination(destination) dirname = join_source(source) FileUtils.mkdir_p dest_dir unless File.exists?(dest_dir) FileUtils.cd(dirname) do Filander.destination_root_stack.push(dest_dir) Filander.source_root_stack.push(dirname) yield Filander.source_root_stack.pop Filander.destination_root_stack.pop end end |