Class: Mite::Server

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config:) ⇒ Server

Returns a new instance of Server.



5
6
7
8
9
10
11
12
# File 'lib/mite/server.rb', line 5

def initialize(config:)
  builder = %{
    Rack::Builder.new do
      #{File.read(config)}
    end
  }
  @application = eval(builder, nil, config)
end

Instance Attribute Details

#applicationObject

Returns the value of attribute application.



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

def application
  @application
end

Instance Method Details

#process(request) ⇒ Object



14
15
16
# File 'lib/mite/server.rb', line 14

def process(request)
  application.call(request.merge("rack.errors" => $stderr, "rack.version" => Rack::VERSION))
end