Class: Capistrano::Configuration::Filter

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

Instance Method Summary collapse

Constructor Details

#initialize(type, values = nil) ⇒ Filter

Returns a new instance of Filter



10
11
12
13
14
15
16
17
18
19
# File 'lib/capistrano/configuration/filter.rb', line 10

def initialize(type, values=nil)
  raise "Invalid filter type #{type}" unless i(host role).include? type
  av = Array(values)
  @strategy = if av.empty? then EmptyFilter.new
              elsif av.include?(:all) || av.include?("all") then NullFilter.new
              elsif type == :host then HostFilter.new(values)
              elsif type == :role then RoleFilter.new(values)
              else NullFilter.new
              end
end

Instance Method Details

#filter(servers) ⇒ Object



21
22
23
# File 'lib/capistrano/configuration/filter.rb', line 21

def filter(servers)
  @strategy.filter servers
end