Class: Rack::NoRobots
- Inherits:
-
Object
- Object
- Rack::NoRobots
- Defined in:
- lib/rack/no_robots.rb,
lib/rack/no_robots/version.rb
Constant Summary collapse
- VERSION =
"0.1.0"
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app) ⇒ NoRobots
constructor
A new instance of NoRobots.
- #robots_txt ⇒ Object
Constructor Details
#initialize(app) ⇒ NoRobots
Returns a new instance of NoRobots.
5 6 7 |
# File 'lib/rack/no_robots.rb', line 5 def initialize(app) @app = app end |
Instance Method Details
#call(env) ⇒ Object
9 10 11 12 13 14 15 |
# 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 ⇒ Object
17 18 19 20 21 22 |
# File 'lib/rack/no_robots.rb', line 17 def robots_txt <<-txt User Agent: * Disallow: / txt end |