Class: SSHKit::Coordinator
- Inherits:
-
Object
- Object
- SSHKit::Coordinator
- Defined in:
- lib/sshkit/coordinator.rb
Instance Attribute Summary collapse
-
#hosts ⇒ Object
Returns the value of attribute hosts.
Instance Method Summary collapse
- #each(options = {}, &block) ⇒ Object
-
#initialize(raw_hosts) ⇒ Coordinator
constructor
A new instance of Coordinator.
Constructor Details
#initialize(raw_hosts) ⇒ Coordinator
Returns a new instance of Coordinator.
7 8 9 10 |
# File 'lib/sshkit/coordinator.rb', line 7 def initialize(raw_hosts) @raw_hosts = Array(raw_hosts) @hosts = @raw_hosts.any? ? resolve_hosts : [] end |
Instance Attribute Details
#hosts ⇒ Object
Returns the value of attribute hosts.
5 6 7 |
# File 'lib/sshkit/coordinator.rb', line 5 def hosts @hosts end |
Instance Method Details
#each(options = {}, &block) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/sshkit/coordinator.rb', line 12 def each(={}, &block) if hosts = .merge() case [:in] when :parallel then Runner::Parallel when :sequence then Runner::Sequential when :groups then Runner::Group else raise RuntimeError, "Don't know how to handle run style #{[:in].inspect}" end.new(hosts, , &block).execute else Runner::Null.new(hosts, , &block).execute end end |