Class: Wicoris::Postman::Copier

Inherits:
Object
  • Object
show all
Defined in:
lib/wicoris/postman/copier.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(job, opts = {}) ⇒ Copier

Returns a new instance of Copier.



9
10
11
12
13
# File 'lib/wicoris/postman/copier.rb', line 9

def initialize(job, opts = {})
  @job = job
  @opts = opts
  @logger = opts[:logger]
end

Instance Attribute Details

#loggerObject (readonly)

Returns the value of attribute logger.



7
8
9
# File 'lib/wicoris/postman/copier.rb', line 7

def logger
  @logger
end

Instance Method Details

#runObject

Copy letter to destination.



16
17
18
19
20
21
22
# File 'lib/wicoris/postman/copier.rb', line 16

def run
  FileUtils.cp(source, destination, :noop => (@opts[:noop] == true))
  logger.debug :message => 'Letter copied',
               :destination => destination,
               :letter => @job.letter,
               :job => @job
end