Class: Capistrano::Configuration::HostFilter

Inherits:
Object
  • Object
show all
Defined in:
lib/capistrano/configuration/host_filter.rb

Instance Method Summary collapse

Constructor Details

#initialize(values) ⇒ HostFilter

Returns a new instance of HostFilter.



4
5
6
7
8
# File 'lib/capistrano/configuration/host_filter.rb', line 4

def initialize(values)
  av = Array(values).dup
  av = av.flat_map { |v| v.is_a?(String) && v =~ /^(?<name>[-A-Za-z0-9.]+)(,\g<name>)*$/ ? v.split(",") : v }
  @rex = regex_matcher(av)
end

Instance Method Details

#filter(servers) ⇒ Object



10
11
12
# File 'lib/capistrano/configuration/host_filter.rb', line 10

def filter(servers)
  Array(servers).select { |s| @rex.match s.to_s }
end