Class: Cylon::Rack

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

Instance Method Summary collapse

Constructor Details

#initialize(app) ⇒ Rack

Returns a new instance of Rack.



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

def initialize(app)
  @app = app
end

Instance Method Details

#call(env) ⇒ Object



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

def call(env)
  if env["PATH_INFO"] == "/robots.txt" && ENV['RACK_ENV'] != "production"
    [200, {"Content-Type" => "text/plain"}, ["User-Agent: *\nDisallow: /"]]
  else
    @app.call(env)
  end
end