Class: Grande::Context

Inherits:
Object
  • Object
show all
Defined in:
lib/grande/context.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#appObject (readonly)

Returns the value of attribute app.



14
15
16
# File 'lib/grande/context.rb', line 14

def app
  @app
end

Class Method Details

.instanceObject



16
17
18
# File 'lib/grande/context.rb', line 16

def self.instance
  @instance ||= new
end

Instance Method Details

#run_after_forkObject

If one is using forking servers, this could should be run to re-setup all DB connections



29
30
31
# File 'lib/grande/context.rb', line 29

def run_after_fork
  @app.restore_db_connections_after_fork
end

#set_app(app) ⇒ Object



20
21
22
23
24
25
# File 'lib/grande/context.rb', line 20

def set_app(app)
  raise "App can't be set twice" if @app
  raise 'App can only be set if in booting phase' unless app.booting?

  @app = app
end