Class: Synco::Method
- Inherits:
-
Controller
- Object
- Controller
- Synco::Method
- Defined in:
- lib/synco/method.rb
Overview
A backup method provides the interface to copy data from one system to another.
Direct Known Subclasses
Synco::Methods::RSync, Synco::Methods::SCP, Synco::Methods::ZFS
Instance Attribute Summary collapse
-
#arguments ⇒ Object
readonly
Returns the value of attribute arguments.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Attributes inherited from Controller
Instance Method Summary collapse
- #call(scope, arguments: []) ⇒ Object
-
#initialize(*command, arguments: [], **options) ⇒ Method
constructor
A new instance of Method.
Methods inherited from Controller
#abort!, build, #fire, #freeze, #on, #try
Constructor Details
#initialize(*command, arguments: [], **options) ⇒ Method
Returns a new instance of Method.
18 19 20 21 22 23 24 |
# File 'lib/synco/method.rb', line 18 def initialize(*command, arguments: [], **) super() @command = command.empty? ? default_command : command @arguments = arguments = end |
Instance Attribute Details
#arguments ⇒ Object (readonly)
Returns the value of attribute arguments.
27 28 29 |
# File 'lib/synco/method.rb', line 27 def arguments @arguments end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
26 27 28 |
# File 'lib/synco/method.rb', line 26 def end |
Instance Method Details
#call(scope, arguments: []) ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/synco/method.rb', line 29 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 |