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.
33 34 35 36 37 38 39 |
# File 'lib/synco/method.rb', line 33 def initialize(*command, arguments: [], **) super() @command = command.empty? ? default_command : command @arguments = arguments @options = end |
Instance Attribute Details
#arguments ⇒ Object (readonly)
Returns the value of attribute arguments.
42 43 44 |
# File 'lib/synco/method.rb', line 42 def arguments @arguments end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
41 42 43 |
# File 'lib/synco/method.rb', line 41 def @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 |