Class: Rack::NoindexHttps
- Inherits:
-
Object
- Object
- Rack::NoindexHttps
- Defined in:
- lib/rack-noindex_https.rb,
lib/rack-noindex_https/version.rb
Constant Summary collapse
- VERSION =
"0.0.4"
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app) ⇒ NoindexHttps
constructor
A new instance of NoindexHttps.
Constructor Details
#initialize(app) ⇒ NoindexHttps
Returns a new instance of NoindexHttps.
5 6 7 |
# File 'lib/rack-noindex_https.rb', line 5 def initialize(app) @app = app end |
Instance Method Details
#call(env) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/rack-noindex_https.rb', line 9 def call(env) puts "got here" @status, @headers, @body = @app.call(env) puts env.inspect if env['rack.url_scheme'] == 'https' && (@headers['Content-Type'] =~ /application\/html/ || @headers['Content-Type'] =~ /text\/html/) @body = @body.collect {|fragement| puts "updating"; fragement.gsub(%r{</head>}, '<meta name="robots" content="noindex"></head>') } end puts 'finished' [@status, @headers, @body] end |