class Hanami::Web::Welcome

Middleware that renders a welcome view in fresh Hanami apps.

@api private @since 2.1.0

Public Class Methods

new(app) click to toggle source

@api private @since 2.1.0

# File lib/hanami/web/welcome.rb, line 15
def initialize(app)
  @app = app
end

Public Instance Methods

call(env) click to toggle source

@api private @since 2.1.0

# 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

Private Instance Methods

hanami_version() click to toggle source

@api private @since 2.1.0

# File lib/hanami/web/welcome.rb, line 35
def hanami_version
  Hanami::VERSION
end
ruby_version() click to toggle source

@api private @since 2.1.0

# File lib/hanami/web/welcome.rb, line 41
def ruby_version
  RUBY_DESCRIPTION
end