Class: Synco::Method

Inherits:
Controller show all
Defined in:
lib/synco/method.rb

Overview

A backup method provides the interface to copy data from one system to another.

Instance Attribute Summary collapse

Attributes inherited from Controller

#events

Instance Method Summary collapse

Methods inherited from Controller

#abort!, build, #fire, #freeze, #on, #try

Constructor Details

#initialize(*command, arguments: [], **options) ⇒ Method

Returns a new instance of Method.



33
34
35
36
37
38
39
# File 'lib/synco/method.rb', line 33

def initialize(*command, arguments: [], **options)
	super()
	
	@command = command.empty? ? default_command : command
	@arguments = arguments
	@options = options
end

Instance Attribute Details

#argumentsObject (readonly)

Returns the value of attribute arguments.



42
43
44
# File 'lib/synco/method.rb', line 42

def arguments
  @arguments
end

#optionsObject (readonly)

Returns the value of attribute options.



41
42
43
# File 'lib/synco/method.rb', line 41

def options
  @options
end

Instance Method Details

#call(scope, arguments: []) ⇒ Object



44
45
46
47
48
49
50
51
52
53
54
# File 'lib/synco/method.rb', line 44

def call(scope, arguments: [])
	server = scope.current_server
	directory = scope.directory
	
	server.run(
		*@command,
		*arguments,
		scope.master_server.connection_string(directory, on: server),
		scope.target_server.connection_string(directory, on: server)
	)
end