class Sinatra::Base

def use_in_file_templates!

def use_in_file_templates!
  line = caller.detect do |s|
    [
     /lib\/sinatra.*\.rb/,
     /\(.*\)/,
     /rubygems\/custom_require\.rb/
    ].all? { |x| s !~ x }
  end
  file = line.sub(/:\d+.*$/, '')
  if data = ::IO.read(file).split('__END__')[1]
    data.gsub!(/\r\n/, "\n")
    template = nil
    data.each_line do |line|
      if line =~ /^@@\s*(.*)/
        template = templates[$1.to_sym] = ''
      elsif template
        template << line
      end
    end
  end
end