Method: Capistrano::Configuration#add_filter
- Defined in:
- lib/capistrano/configuration.rb
#add_filter(filter = nil, &block) ⇒ Object
117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 |
# File 'lib/capistrano/configuration.rb', line 117 def add_filter(filter=nil, &block) if block raise ArgumentError, "Both a block and an object were given" if filter filter = Object.new def filter.filter(servers) block.call(servers) end elsif !filter.respond_to? :filter raise TypeError, "Provided custom filter <#{filter.inspect}> does " \ "not have a public 'filter' method" end @custom_filters ||= [] @custom_filters << filter end |