class Ekylibre::MultiTenancy::TenantStack

Stack allowing to track which is the current tenant across multiple nested contexts

Public Class Methods

new() click to toggle source
# File lib/ekylibre/multi_tenancy/tenant_stack.rb, line 7
def initialize
  @stack = []
end

Public Instance Methods

current() click to toggle source

@return [Tenant, nil]

# File lib/ekylibre/multi_tenancy/tenant_stack.rb, line 12
def current
  @stack.last
end
pop() click to toggle source
# File lib/ekylibre/multi_tenancy/tenant_stack.rb, line 16
def pop
  @stack.pop

  nil
end
push(tenant) click to toggle source

@param [Tenant] tenant

# File lib/ekylibre/multi_tenancy/tenant_stack.rb, line 23
def push(tenant)
  @stack << tenant
end
size() click to toggle source
# File lib/ekylibre/multi_tenancy/tenant_stack.rb, line 27
def size
  @stack.size
end