Class: Hanami::Web::Welcome Private
- Inherits:
-
Object
- Object
- Hanami::Web::Welcome
- Defined in:
- lib/hanami/web/welcome.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Middleware that renders a welcome view in fresh Hanami apps.
Instance Method Summary collapse
- #call(env) ⇒ Object private
-
#initialize(app) ⇒ Welcome
constructor
private
A new instance of Welcome.
Constructor Details
#initialize(app) ⇒ Welcome
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of Welcome.
15 16 17 |
# File 'lib/hanami/web/welcome.rb', line 15 def initialize(app) @app = app end |
Instance Method Details
#call(env) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
21 22 23 24 25 26 27 28 29 |
# File 'lib/hanami/web/welcome.rb', line 21 def call(env) request_path = env["REQUEST_PATH"] || "" request_host = env["HTTP_HOST"] || "" template_path = File.join(__dir__, "welcome.html.erb") body = [ERB.new(File.read(template_path)).result(binding)] [200, {}, body] end |