Class: Capistrano::Configuration::Filter
- Inherits:
-
Object
- Object
- Capistrano::Configuration::Filter
- Defined in:
- lib/capistrano/configuration/filter.rb
Instance Method Summary collapse
- #filter(servers) ⇒ Object
-
#initialize(type, values = nil) ⇒ Filter
constructor
A new instance of Filter.
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 |