Camping.goes :Nuts2 module Nuts2::Controllers class Static < R '/static/(.+)' PATH = __FILE__[/(.*)\//, 1] def get(path) unless path =~ /\.\./ # sample test to prevent directory traversal attacks @headers['X-Sendfile'] = "#{PATH}/static/#{path}" else "404 - Invalid path" end end end # The root slash shows the `index' view. class Index < R '/' def get render :index end end end # end module module Nuts2::Views def index text( "Dreaming about cows jumping over the moon?..." ) p '' img 'me', :src => "static/cows-geneva.GIF" text( "..No..." ) p '' h2 'Camping' p Time.now.to_s end end # end module