class Rack::Cors::Result
Constants
- HEADER_KEY
- MISS_NO_ORIGIN
- MISS_NO_PATH
Attributes
hit[RW]
miss_reason[RW]
preflight[RW]
Public Class Methods
hit(env)
click to toggle source
# File lib/rack/cors.rb, line 208 def self.hit(env) r = Result.new r.preflight = false r.hit = true env[ENV_KEY] = r end
miss(env, reason)
click to toggle source
# File lib/rack/cors.rb, line 215 def self.miss(env, reason) r = Result.new r.preflight = false r.hit = false r.miss_reason = reason env[ENV_KEY] = r end
preflight_hit(env)
click to toggle source
# File lib/rack/cors.rb, line 223 def self.preflight_hit(env) r = Result.new r.preflight = true r.hit = true env[ENV_KEY] = r end
preflight_miss(env, reason)
click to toggle source
# File lib/rack/cors.rb, line 230 def self.preflight_miss(env, reason) r = Result.new r.preflight = true r.hit = false r.miss_reason = reason env[ENV_KEY] = r end
Public Instance Methods
append_header(headers)
click to toggle source
# File lib/rack/cors.rb, line 238 def append_header(headers) headers[HEADER_KEY] = if hit? preflight? ? 'preflight-hit' : 'hit' else [ (preflight? ? 'preflight-miss' : 'miss'), miss_reason ].join('; ') end end
hit?()
click to toggle source
# File lib/rack/cors.rb, line 200 def hit? !!hit end
preflight?()
click to toggle source
# File lib/rack/cors.rb, line 204 def preflight? !!preflight end