Class: Chassis::Rack::NoRobots

Inherits:
Object
  • Object
show all
Defined in:
lib/chassis/rack/no_robots.rb

Instance Method Summary collapse

Constructor Details

#initialize(app) ⇒ NoRobots

Returns a new instance of NoRobots.



4
5
6
# File 'lib/chassis/rack/no_robots.rb', line 4

def initialize(app)
  @app = app
end

Instance Method Details

#call(env) ⇒ Object



8
9
10
11
12
13
14
# File 'lib/chassis/rack/no_robots.rb', line 8

def call(env)
  if env['PATH_INFO'] == '/robots.txt'
    [200, {'Content-Type' => 'text/plain'}, [robots_txt]]
  else
    @app.call env
  end
end

#robots_txtObject



16
17
18
19
20
21
# File 'lib/chassis/rack/no_robots.rb', line 16

def robots_txt
<<-txt
User Agent: *
Disallow: /
txt
end