# File firewall/lib/symbiosis/firewall/template.rb, line 323
      def to_s
        template = File.read(self.template_file)
        #
        # Detect if this is a legacy-style rule, or an ERB one. 
        #
        if template =~ /\$(SRC|DEST)/
          #
          # Legacy template.
          #
          lines = template.split("\n")

          if !ipv4? and lines.any?{|l| l =~ /^[^#]*iptables /}
            warn "Disabling IPv4 rules for non-IPv4 addresses in #{self.name}" if $VERBOSE
            lines = lines.collect{|l| l =~ /^[^#]*iptables / ? "# "+l : l }
          end

          if !ipv6? and lines.any?{|l| l =~ /^[^#]*ip6tables /}
            warn "Disabling IPv6 rules for non-IPv6 addresses in #{self.name}" if $VERBOSE
            lines = lines.collect{|l| l =~ /^[^#]*ip6tables / ? "# "+l : l }
          end

          lines = lines.collect do |l|
            #
            # Skip commented lines.
            #
            next if l =~ /^#/

            # 
            # Replace SRC and DEST variable
            #
            l = l.gsub("$SRC",src).gsub("$DEST",dst)

            #
            # Check there aren't any more odd variables.
            #
            while l =~ /^[^#]*(\$[A-Z]+)/
              warn "Bad variable #{$1} in #{self.template_file} -- removing!"
              l = l.gsub($1,"")
            end

            #
            # Return the newly mangled line.
            #
            l
          end

          return lines.join("\n") 
        else
          begin
            # Return the interpolated template.
            return ERB.new(template,0,'%>').result(binding)

          rescue NoMethodError,ArgumentError,SyntaxError => err
            # Rescue  
            warn "Caught error in #{template_file}: #{err.to_s}"
            raise err
          end

        end
      end