Class: DryCleaner

Inherits:
Object
  • Object
show all
Defined in:
lib/bvwack/drycleaner.rb

Instance Method Summary collapse

Constructor Details

#initialize(options_list, to_clean_list, not_converted_list) ⇒ DryCleaner

Returns a new instance of DryCleaner.



2
3
4
5
6
7
8
9
10
11
# File 'lib/bvwack/drycleaner.rb', line 2

def initialize(options_list, to_clean_list, not_converted_list)
  @options_list                  = options_list
  @to_clean_list            = to_clean_list
  @not_converted_list = not_converted_list
  if @options_list[:base_dir]
    @clean_dir = "#{@options_list[:base_dir]}/bvwack-back"
  else
    @clean_dir = DEFAULT_CLEAN_BASE_DIR
  end
end

Instance Method Details

#dry_clean_upObject



13
14
15
16
17
18
19
20
# File 'lib/bvwack/drycleaner.rb', line 13

def dry_clean_up
  if @to_clean_list.length > 0
    key      = @to_clean_list.pop
    filename = @not_converted_list[key]
    dirname  = File.dirname(@not_converted_list[key])
    puts %Q{mkdir -p "#{@clean_dir}/#{dirname}" && mv "#{filename}" "#{@clean_dir}/#{filename}"\n\n}
  end
end