Sha256: 76ba794243d89d241675ca3b948ac28a463015c42e74631f0cfacdadeff26521
Contents?: true
Size: 873 Bytes
Versions: 3
Compression:
Stored size: 873 Bytes
Contents
require 'erb' require 'pathname' require 'hanami/environment' require 'hanami/utils/string' module Hanami # @api private class Welcome # @api private def initialize(_app) @root = Pathname.new(__dir__).join('templates').realpath end # @api private def call(env) @request_path = env['REQUEST_PATH'] || '' @request_host = env['HTTP_HOST'] || '' @body = [ERB.new(@root.join('welcome.html.erb').read).result(binding)] [200, {}, @body] end # @api private def application_name application_class.app_name end private # @api private def application_class Hanami.configuration.apps do |app| if app.host.nil? return app if @request_path.include?(app.path_prefix) else return app if @request_host == app.host end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
hanami-1.3.5 | lib/hanami/welcome.rb |
hanami-1.3.4 | lib/hanami/welcome.rb |
hanami-1.3.3 | lib/hanami/welcome.rb |