Class: Capistrano::Configuration::RoleFilter
- Inherits:
-
Object
- Object
- Capistrano::Configuration::RoleFilter
- Defined in:
- lib/capistrano/configuration/role_filter.rb
Instance Method Summary collapse
- #filter(servers) ⇒ Object
-
#initialize(values) ⇒ RoleFilter
constructor
A new instance of RoleFilter.
Constructor Details
#initialize(values) ⇒ RoleFilter
Returns a new instance of RoleFilter.
4 5 6 7 8 |
# File 'lib/capistrano/configuration/role_filter.rb', line 4 def initialize(values) av = Array(values).dup av = av.flat_map { |v| v.is_a?(String) ? v.split(",") : v } @rex = regex_matcher(av) end |
Instance Method Details
#filter(servers) ⇒ Object
10 11 12 |
# File 'lib/capistrano/configuration/role_filter.rb', line 10 def filter(servers) Array(servers).select { |s| s.is_a?(String) ? false : s.roles.any? { |r| @rex.match r } } end |