class Capistrano::Configuration::Filter

Public Class Methods

new(type, values=nil) click to toggle source
# File lib/capistrano/configuration/filter.rb, line 10
def initialize(type, values=nil)
  raise "Invalid filter type #{type}" unless [:host, :role].include? type
  av = Array(values)
  @strategy = case
              when av.empty? then EmptyFilter.new
              when av.include?(:all), av.include?("all") then NullFilter.new
              when type == :host then HostFilter.new(values)
              when type == :role then RoleFilter.new(values)
              else NullFilter.new
              end
end

Public Instance Methods

filter(servers) click to toggle source
# File lib/capistrano/configuration/filter.rb, line 22
def filter(servers)
  @strategy.filter servers
end