Class: Mxrb::RubyApp::RackAdapter
- Inherits:
-
Object
- Object
- Mxrb::RubyApp::RackAdapter
- Defined in:
- lib/mxrb/ruby_app.rb
Overview
Exposes the same generic MXRB backend through the Rack protocol. Puma, Sinatra and Rails presets mount this adapter instead of duplicating API behavior or introducing a second application state.
Defined Under Namespace
Instance Attribute Summary collapse
-
#root ⇒ Object
readonly
Returns the value of attribute root.
Instance Method Summary collapse
- #call(environment) ⇒ Object
- #close ⇒ Object
-
#initialize(root) ⇒ RackAdapter
constructor
A new instance of RackAdapter.
- #server ⇒ Object
Constructor Details
#initialize(root) ⇒ RackAdapter
Returns a new instance of RackAdapter.
1237 1238 1239 1240 |
# File 'lib/mxrb/ruby_app.rb', line 1237 def initialize(root) @root = File.(root) @server_mutex = Mutex.new end |
Instance Attribute Details
#root ⇒ Object (readonly)
Returns the value of attribute root.
1235 1236 1237 |
# File 'lib/mxrb/ruby_app.rb', line 1235 def root @root end |
Instance Method Details
#call(environment) ⇒ Object
1246 1247 1248 1249 1250 1251 |
# File 'lib/mxrb/ruby_app.rb', line 1246 def call(environment) request = rack_request(environment) response = Response.new server.send(:dispatch, request, response) [response.status, response.headers, [response.body.to_s]] end |
#close ⇒ Object
1253 |
# File 'lib/mxrb/ruby_app.rb', line 1253 def close = @server&.application&.close |