Class: Jasmine::Server

Inherits:
Object
  • Object
show all
Defined in:
lib/jasmine/server.rb

Instance Method Summary collapse

Constructor Details

#initialize(port = 8888, application = nil) ⇒ Server

Returns a new instance of Server.



3
4
5
6
# File 'lib/jasmine/server.rb', line 3

def initialize(port = 8888, application = nil)
  @port = port
  @application = application
end

Instance Method Details

#startObject



8
9
10
11
12
13
14
15
16
17
18
# File 'lib/jasmine/server.rb', line 8

def start
  if Jasmine::Dependencies.legacy_rack?
    handler = Rack::Handler.get('webrick')
    handler.run(@application, :Port => @port, :AccessLog => [])
  else
    server = Rack::Server.new(:Port => @port, :AccessLog => [])
    # workaround for Rack bug, when Rack > 1.2.1 is released Rack::Server.start(:app => Jasmine.app(self)) will work
    server.instance_variable_set(:@app, @application)
    server.start
  end
end