Class: Rack::DoNotTrack
- Inherits:
-
Object
- Object
- Rack::DoNotTrack
- Defined in:
- lib/donottrack.rb
Constant Summary collapse
- DEFAULT_DNT_BIT =
0
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, dnt_bit = nil) ⇒ DoNotTrack
constructor
A new instance of DoNotTrack.
Constructor Details
#initialize(app, dnt_bit = nil) ⇒ DoNotTrack
Returns a new instance of DoNotTrack.
5 6 7 8 |
# File 'lib/donottrack.rb', line 5 def initialize(app, dnt_bit = nil) @app = app @dnt_bit = dnt_bit end |
Instance Method Details
#call(env) ⇒ Object
10 11 12 13 |
# File 'lib/donottrack.rb', line 10 def call(env) env['HTTP_DNT'] = @dnt_bit.nil? ? (env['HTTP_DNT'] || env['HTTP_X_DO_NOT_TRACK'] || DEFAULT_DNT_BIT) : @dnt_bit @app.call(env) end |