First, is there any better way to read a whole file into a string
variable than this:

    template = IO.readlines(@template, nil)[0]

Second, I wanted code that replaces all strings "<!-- XXX -->" with the
return value of the XXX method.  Is there any better way than the
following to do this?  I don't like having to repeat the regexp match to
pull out the (\S+).

    page = template.gsub(/\<!--\s+\S+\s+-->/) { |s|
      if /\<!--\s+(\S+)\s+-->/ =~ s
        send($1)
      end
    }

Any help is appreciated!

-- 
matt