Class: Archiver::Action::Renaming

Inherits:
Object
  • Object
show all
Defined in:
lib/archiver/action/renaming.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(source, destination, output) ⇒ Renaming

Returns a new instance of Renaming.



15
16
17
18
19
20
21
22
23
24
# File 'lib/archiver/action/renaming.rb', line 15

def initialize(source, destination, output)
  @source = source
  @destination = destination
  @output = output

  @records = []

  check_directories
  load_records
end

Instance Attribute Details

#destinationObject

Returns the value of attribute destination.



10
11
12
# File 'lib/archiver/action/renaming.rb', line 10

def destination
  @destination
end

#outputObject

Returns the value of attribute output.



11
12
13
# File 'lib/archiver/action/renaming.rb', line 11

def output
  @output
end

#recordsObject

Returns the value of attribute records.



13
14
15
# File 'lib/archiver/action/renaming.rb', line 13

def records
  @records
end

#sourceObject

Returns the value of attribute source.



9
10
11
# File 'lib/archiver/action/renaming.rb', line 9

def source
  @source
end

Instance Method Details

#processObject



26
27
28
29
30
31
32
33
34
35
# File 'lib/archiver/action/renaming.rb', line 26

def process
  records.each do |record|
    next unless record.process?
    
    record.move destination
    output.process record
  end
  
  output.finish!
end