Class: Synco::ScriptScope
- Inherits:
-
Object
- Object
- Synco::ScriptScope
- Defined in:
- lib/synco/scope.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#current_server ⇒ Object
readonly
Returns the value of attribute current_server.
-
#group ⇒ Object
readonly
Returns the value of attribute group.
-
#master_server ⇒ Object
readonly
Returns the value of attribute master_server.
-
#script ⇒ Object
readonly
Returns the value of attribute script.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(script, group) ⇒ ScriptScope
constructor
A new instance of ScriptScope.
- #method ⇒ Object
Constructor Details
#initialize(script, group) ⇒ ScriptScope
Returns a new instance of ScriptScope.
52 53 54 55 56 57 58 |
# File 'lib/synco/scope.rb', line 52 def initialize(script, group) @script = script @group = group @current_server = ServerScope.new(@script.current_server, self) @master_server = ServerScope.new(@script.master_server, self, @current_server) end |
Instance Attribute Details
#current_server ⇒ Object (readonly)
Returns the value of attribute current_server.
63 64 65 |
# File 'lib/synco/scope.rb', line 63 def current_server @current_server end |
#group ⇒ Object (readonly)
Returns the value of attribute group.
61 62 63 |
# File 'lib/synco/scope.rb', line 61 def group @group end |
#master_server ⇒ Object (readonly)
Returns the value of attribute master_server.
62 63 64 |
# File 'lib/synco/scope.rb', line 62 def master_server @master_server end |
#script ⇒ Object (readonly)
Returns the value of attribute script.
60 61 62 |
# File 'lib/synco/scope.rb', line 60 def script @script end |
Instance Method Details
#call ⇒ Object
69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 |
# File 'lib/synco/scope.rb', line 69 def call if @script.running_on_master? Console.info(self, "We are the master server...") else Console.info(self, "We are not the master server...", master: @master) end @script.try(self) do # This allows events to run on the master server if specified, before running any backups. @master_server.try(master_target_server) do method.try(self) do Console.info(self, "Running backups...", server: @current_server) run_servers(group) end end end end |
#method ⇒ Object
65 66 67 |
# File 'lib/synco/scope.rb', line 65 def method @script.method end |