Class: MovieOrganizer::FileCopier

Inherits:
Object
  • Object
show all
Defined in:
lib/movie_organizer/file_copier.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(filename, target_file, options) ⇒ FileCopier



8
9
10
11
12
13
# File 'lib/movie_organizer/file_copier.rb', line 8

def initialize(filename, target_file, options)
  @filename = filename
  @target_file = target_file
  @options = options
  @logger = Logger.instance
end

Instance Attribute Details

#filenameObject

Returns the value of attribute filename.



5
6
7
# File 'lib/movie_organizer/file_copier.rb', line 5

def filename
  @filename
end

#hostnameObject (readonly)

Returns the value of attribute hostname.



6
7
8
# File 'lib/movie_organizer/file_copier.rb', line 6

def hostname
  @hostname
end

#loggerObject (readonly)

Returns the value of attribute logger.



6
7
8
# File 'lib/movie_organizer/file_copier.rb', line 6

def logger
  @logger
end

#optionsObject

Returns the value of attribute options.



5
6
7
# File 'lib/movie_organizer/file_copier.rb', line 5

def options
  @options
end

#remote_filenameObject (readonly)

Returns the value of attribute remote_filename.



6
7
8
# File 'lib/movie_organizer/file_copier.rb', line 6

def remote_filename
  @remote_filename
end

#target_fileObject

Returns the value of attribute target_file.



5
6
7
# File 'lib/movie_organizer/file_copier.rb', line 5

def target_file
  @target_file
end

#usernameObject (readonly)

Returns the value of attribute username.



6
7
8
# File 'lib/movie_organizer/file_copier.rb', line 6

def username
  @username
end

Instance Method Details

#copyObject



15
16
17
# File 'lib/movie_organizer/file_copier.rb', line 15

def copy
  ssh? ? remote_copy : local_copy
end