Class: Soybean::Application

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(services, &block) ⇒ Application

Returns a new instance of Application.



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/soybean/application.rb', line 9

def initialize(services, &block)
  load!(services)
  configure(&block)

  logger.info "SOAP Services: START"
  at_exit{ logger.info "SOAP Services: STOP" }

  @app = Rack::Builder.new do
    Soybean.engines.each do |engine|
      engine.logger.info "Service found: #{engine.service.endpoint} route to /#{engine.service.class.name}" if engine.logger
      map "/#{engine.service.endpoint}" do
        run engine.new
      end
    end

    Soybean.engines.last.logger.info ""
  end.to_app
end

Instance Attribute Details

#servicesObject (readonly)

Returns the value of attribute services.



7
8
9
# File 'lib/soybean/application.rb', line 7

def services
  @services
end

Instance Method Details

#call(env) ⇒ Object



28
29
30
# File 'lib/soybean/application.rb', line 28

def call(env)
  @app.call(env)
end

#logger(new_logger = nil) ⇒ Object



32
33
34
35
# File 'lib/soybean/application.rb', line 32

def logger(new_logger=nil)
  @logger = new_logger unless new_logger.nil?
  @logger || Soybean.logger
end