定义一个继承自 Rack::Builder 的类
我正在尝试为我正在构建的 gem 构建一个 Server
类。这可以定义call (env)
,这将使它成为一个机架应用程序。但是,我想使用 Rack::Builder
并根据我的需要映射不同类型的 URL。
我不知道如何解释这一点,但是有没有一种方法可以从 Rack::Builder 或其他东西继承?我想将 URL 映射隔离到它自己的方法中,这样我就可以在一个类中测试它们,从而赋予它意义和隔离。
谢谢。
I'm trying to build a Server
class for a gem I'm building. This could define call (env)
which would make it a rack app. However, I want to use Rack::Builder
and map different kinds of URLs, according to my needs.
I'm not sure how to explain this but is there a way to inherit from Rack::Builder or something? I want to isolate the URL mappings into its own methods so I can test them in one class, so as to give meaning and isolation to it.
Thank you.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您不需要从 Rack::Builder 继承。你可以这样做。
config.ru
或
You do not need to inherit from Rack::Builder. You can do like that.
config.ru
or