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.
-
#logger ⇒ Object
readonly
Returns the value of attribute logger.
-
#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, logger, group) ⇒ ScriptScope
constructor
A new instance of ScriptScope.
- #method ⇒ Object
Constructor Details
#initialize(script, logger, group) ⇒ ScriptScope
Returns a new instance of ScriptScope.
79 80 81 82 83 84 85 86 |
# File 'lib/synco/scope.rb', line 79 def initialize(script, logger, group) @script = script @logger = logger @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.
92 93 94 |
# File 'lib/synco/scope.rb', line 92 def current_server @current_server end |
#group ⇒ Object (readonly)
Returns the value of attribute group.
90 91 92 |
# File 'lib/synco/scope.rb', line 90 def group @group end |
#logger ⇒ Object (readonly)
Returns the value of attribute logger.
89 90 91 |
# File 'lib/synco/scope.rb', line 89 def logger @logger end |
#master_server ⇒ Object (readonly)
Returns the value of attribute master_server.
91 92 93 |
# File 'lib/synco/scope.rb', line 91 def master_server @master_server end |
#script ⇒ Object (readonly)
Returns the value of attribute script.
88 89 90 |
# File 'lib/synco/scope.rb', line 88 def script @script end |
Instance Method Details
#call ⇒ Object
98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 |
# File 'lib/synco/scope.rb', line 98 def call if @script.running_on_master? logger.info "We are the master server..." else logger.info "We are not the master server..." logger.info "Master server is #{@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 logger.info "Running backups for server #{@current_server}..." run_servers(group) end end end end |
#method ⇒ Object
94 95 96 |
# File 'lib/synco/scope.rb', line 94 def method @script.method end |