Class: Lore::Context
- Inherits:
-
Object
- Object
- Lore::Context
- Defined in:
- lib/lore/connection.rb
Constant Summary collapse
Class Method Summary collapse
- .clear ⇒ Object
- .enter(context_name) ⇒ Object
- .get_connection ⇒ Object
- .inspect ⇒ Object
- .leave ⇒ Object
- .switch_to(project) ⇒ Object
Class Method Details
.clear ⇒ Object
41 42 43 44 |
# File 'lib/lore/connection.rb', line 41 def self.clear() @@context_stack = Array.new $cb__project = nil end |
.enter(context_name) ⇒ Object
31 32 33 34 |
# File 'lib/lore/connection.rb', line 31 def self.enter(context_name) Lore.log { 'Entering context ' + context_name.to_s } @@context_stack.push(context_name) end |
.get_connection ⇒ Object
20 21 22 23 24 25 |
# File 'lib/lore/connection.rb', line 20 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 |
.inspect ⇒ Object
27 28 29 |
# File 'lib/lore/connection.rb', line 27 def self.inspect @@context_stack.inspect end |
.leave ⇒ Object
36 37 38 39 |
# File 'lib/lore/connection.rb', line 36 def self.leave() context_name = @@context_stack.pop @@logger.debug('Leaving context ' << context_name.to_s) end |
.switch_to(project) ⇒ Object
46 47 48 49 50 |
# File 'lib/lore/connection.rb', line 46 def self.switch_to(project) clear() enter(project.context) $cb__project = project end |