Class: Rigger::ServerResolver
- Inherits:
-
Object
- Object
- Rigger::ServerResolver
- Defined in:
- lib/rigger/server_resolver.rb
Instance Method Summary collapse
- #call(task) ⇒ Object
-
#initialize(config) ⇒ ServerResolver
constructor
A new instance of ServerResolver.
Constructor Details
#initialize(config) ⇒ ServerResolver
Returns a new instance of ServerResolver.
3 4 5 |
# File 'lib/rigger/server_resolver.rb', line 3 def initialize(config) @config = config end |
Instance Method Details
#call(task) ⇒ Object
7 8 9 10 11 12 13 14 15 |
# File 'lib/rigger/server_resolver.rb', line 7 def call(task) roles = [*task.[:role]].compact only = task..fetch(:only, {}) role_servers = roles.empty? ? @config.servers : from_roles(roles) only_servers = only.empty? ? @config.servers : from_only(only) (role_servers & only_servers) end |