class Rack::NoRobots

Constants

VERSION

Public Class Methods

new(app) click to toggle source
# File lib/rack/no_robots.rb, line 5
def initialize(app)
  @app = app
end

Public Instance Methods

call(env) click to toggle source
# File lib/rack/no_robots.rb, line 9
def call(env)
  if env['PATH_INFO'] == '/robots.txt'
    [200, {'Content-Type' => 'text/plain'}, [robots_txt]]
  else
    @app.call env
  end
end
robots_txt() click to toggle source
# File lib/rack/no_robots.rb, line 17
    def robots_txt
<<-txt
User Agent: *
Disallow: /
txt
    end