Class: Ey::Core::Cli::Helpers::ServerSieve
- Inherits:
-
Object
- Object
- Ey::Core::Cli::Helpers::ServerSieve
- Defined in:
- lib/ey-core/cli/helpers/server_sieve.rb
Constant Summary collapse
- ROLES =
[ :app_servers, :db_servers, :app_master, :db_master, :utilities ]
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#servers_api ⇒ Object
readonly
Returns the value of attribute servers_api.
Class Method Summary collapse
Instance Method Summary collapse
- #filtered ⇒ Object
-
#initialize(servers_api, options = {}) ⇒ ServerSieve
constructor
A new instance of ServerSieve.
Constructor Details
#initialize(servers_api, options = {}) ⇒ ServerSieve
Returns a new instance of ServerSieve.
20 21 22 23 |
# File 'lib/ey-core/cli/helpers/server_sieve.rb', line 20 def initialize(servers_api, = {}) @servers_api = servers_api @options = end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
14 15 16 |
# File 'lib/ey-core/cli/helpers/server_sieve.rb', line 14 def @options end |
#servers_api ⇒ Object (readonly)
Returns the value of attribute servers_api.
14 15 16 |
# File 'lib/ey-core/cli/helpers/server_sieve.rb', line 14 def servers_api @servers_api end |
Class Method Details
.filter(servers_api, options = {}) ⇒ Object
16 17 18 |
# File 'lib/ey-core/cli/helpers/server_sieve.rb', line 16 def self.filter(servers_api, = {}) new(servers_api, ).filtered end |
Instance Method Details
#filtered ⇒ Object
25 26 27 28 29 30 31 |
# File 'lib/ey-core/cli/helpers/server_sieve.rb', line 25 def filtered return all_servers if requested?(:all) requested_roles.map {|role| role == :utilities ? utils_named(option(:utilities)) : send(role) }.flatten.uniq end |