Class: Lore::Context

Inherits:
Object show all
Defined in:
lib/lore/adapters/context.rb

Constant Summary collapse

@@context_stack =
Array.new

Class Method Summary collapse

Class Method Details

.enter(context_name) ⇒ Object



29
30
31
32
# File 'lib/lore/adapters/context.rb', line 29

def self.enter(context_name)
  Lore.logger.debug { "Entering context #{context_name}" }
  @@context_stack.push(context_name.to_sym)
end

.get_connectionObject



14
15
16
17
18
19
# File 'lib/lore/adapters/context.rb', line 14

def self.get_connection()
  if @@context_stack.empty? then
    raise ::Exception.new('No context given. ')
  end
  return Connection_Pool.get_connection(@@context_stack.last)
end

.get_contextObject



21
22
23
# File 'lib/lore/adapters/context.rb', line 21

def self.get_context
  @@context_stack.last
end

.inspectObject



25
26
27
# File 'lib/lore/adapters/context.rb', line 25

def self.inspect
  @@context_stack.inspect
end

.leaveObject



34
35
36
37
# File 'lib/lore/adapters/context.rb', line 34

def self.leave()
  Lore.logger.debug { "Leaving context #{context_name}" } 
  context_name = @@context_stack.pop
end