Class: RubyClone::ToFolder

Inherits:
Object
  • Object
show all
Defined in:
lib/ruby_clone/profile.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path, options = {}) ⇒ ToFolder

Returns a new instance of ToFolder.



46
47
48
49
# File 'lib/ruby_clone/profile.rb', line 46

def initialize(path, options = {})
  @path = path
  @options = options
end

Instance Attribute Details

#backupObject

Returns the value of attribute backup.



43
44
45
# File 'lib/ruby_clone/profile.rb', line 43

def backup
  @backup
end

#pathObject

Returns the value of attribute path.



44
45
46
# File 'lib/ruby_clone/profile.rb', line 44

def path
  @path
end

Instance Method Details

#delete_filesObject



51
52
53
# File 'lib/ruby_clone/profile.rb', line 51

def delete_files
  @backup.delete_files if @backup
end

#ssh?Boolean

Returns:

  • (Boolean)


64
65
66
67
68
69
70
# File 'lib/ruby_clone/profile.rb', line 64

def ssh?
  if @options[:ssh]
    true
  else
    false
  end
end

#to_commandObject



55
56
57
58
59
60
61
62
# File 'lib/ruby_clone/profile.rb', line 55

def to_command
  command = ""
  command << "--delete " if @options[:delete]
  command << "--delete-excluded " if @options[:delete_excluded]

  command << backup.to_command if backup
  command.strip
end

#to_sObject



72
73
74
75
# File 'lib/ruby_clone/profile.rb', line 72

def to_s
  return "#{@options[:ssh]}:#{@path}" if @options[:ssh]
  return @path if not @options[:ssh]
end