Class: RubyApp::Rack::Application

Inherits:
Object
  • Object
show all
Defined in:
lib/ruby_app/rack/application.rb

Instance Method Summary collapse

Constructor Details

#initialize(application, options = {}) ⇒ Application

Returns a new instance of Application.



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/ruby_app/rack/application.rb', line 8

def initialize(application, options = {})
  @application = application
  RubyApp::Configuration.load!(options[:configuration_paths])
  RubyApp::Log.open!
  RubyApp::Application.create!
  RubyApp::Session.start_thread!

  Signal.trap('HUP') do
    begin
      RubyApp::Log.reopen!
    rescue => exception
      RubyApp::Log.exception(RubyApp::Log::ERROR, exception)
    end
  end

  Signal.trap('EXIT') do
    begin
      RubyApp::Session.stop_thread!
      RubyApp::Application.destroy!
      RubyApp::Log.close!
      RubyApp::Configuration.unload!
    rescue => exception
      RubyApp::Log.exception(RubyApp::Log::ERROR, exception)
    end
  end

end

Instance Method Details

#call(environment) ⇒ Object



36
37
38
# File 'lib/ruby_app/rack/application.rb', line 36

def call(environment)
  return @application.call(environment)
end