Class: IgnoreGoogleIndex::Rack

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

Instance Method Summary collapse

Constructor Details

#initialize(app) ⇒ Rack

Returns a new instance of Rack.



3
4
5
# File 'lib/ignore_google_index/rack.rb', line 3

def initialize(app)
  @app = app
end

Instance Method Details

#call(env) ⇒ Object



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

def call(env)
  status, headers, response = @app.call(env)

  if ENV['IGNORE_GOOGLE_INDEX'] == '1'
    headers['X-Robots-Tag'] = 'none'
  end

  [status, headers, response]
end