def watcher_delegate(proxy_var)
      %w{attach attached? detach enable disable}.each do |method|
        module_eval <<-EOD
          def #{method}(*args)
            if defined? #{proxy_var} and #{proxy_var}
              #{proxy_var}.#{method}(*args)
              return self
            end

            super
          end
        EOD
      end
    end
def watcher_delegate(proxy_var)
      %w{attach attached? detach enable disable}.each do |method|
        module_eval <<-EOD
          def #{method}(*args)
            if defined? #{proxy_var} and #{proxy_var}
              #{proxy_var}.#{method}(*args)
              return self
            end

            super
          end
        EOD
      end
    end
Use an alternate watcher with the attach/detach/enable/disable methods
 if it is presently assigned.  This is useful if you are waiting for
 an event to occur before the current watcher can be used in earnest,
 such as making an outgoing TCP connection.