Class: Rack::MultiTenant::GetIdentity::Next
- Inherits:
-
Object
- Object
- Rack::MultiTenant::GetIdentity::Next
- Defined in:
- lib/rack/multitenant/get_identity.rb
Instance Method Summary collapse
- #call(result) ⇒ Object
- #create_identity_with(subapp) ⇒ Object
- #forbid!(forbidden_app = nil) ⇒ Object
-
#initialize(app, env) ⇒ Next
constructor
A new instance of Next.
- #pass(identity) ⇒ Object
Constructor Details
#initialize(app, env) ⇒ Next
Returns a new instance of Next.
13 14 15 |
# File 'lib/rack/multitenant/get_identity.rb', line 13 def initialize(app, env) @app, @env = app, env end |
Instance Method Details
#call(result) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/rack/multitenant/get_identity.rb', line 17 def call(result) case result when Proc result.call(self) when nil forbid! when false forbid! else pass result end end |
#create_identity_with(subapp) ⇒ Object
40 41 42 |
# File 'lib/rack/multitenant/get_identity.rb', line 40 def create_identity_with(subapp) # TODO: calls subapp that either creates or gets the user on the path to creating a new identity. end |
#forbid!(forbidden_app = nil) ⇒ Object
35 36 37 38 |
# File 'lib/rack/multitenant/get_identity.rb', line 35 def forbid!(forbidden_app = nil) [403, {"Content-Type" => "text/html"}, "No identity found for #{@env['rack.multitenant.current_tenant']}"] end |
#pass(identity) ⇒ Object
30 31 32 33 |
# File 'lib/rack/multitenant/get_identity.rb', line 30 def pass(identity) @env["rack.multitenant.identity"] = identity @app.call(@env) end |