Class: Rack::FlocBlock
- Inherits:
-
Object
- Object
- Rack::FlocBlock
- Defined in:
- lib/rack/floc_block.rb,
lib/rack/floc_block/railtie.rb,
lib/rack/floc_block/version.rb
Defined Under Namespace
Classes: Railtie
Constant Summary collapse
- PERMISSIONS_POLICY =
"Permissions-Policy"
- VERSION =
"0.1.0"
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app) ⇒ FlocBlock
constructor
A new instance of FlocBlock.
Constructor Details
#initialize(app) ⇒ FlocBlock
Returns a new instance of FlocBlock.
8 9 10 |
# File 'lib/rack/floc_block.rb', line 8 def initialize(app) @app = app end |
Instance Method Details
#call(env) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/rack/floc_block.rb', line 12 def call(env) status, headers, body = @app.call(env) headers = Rack::Utils::HeaderHash[headers] = headers[PERMISSIONS_POLICY] || "" if !.match?(/interest\-cohort/) policies = .split(",").map(&:strip) policies << "interest-cohort=()" headers[PERMISSIONS_POLICY] = policies.join(", ") end [status, headers, body] end |