Class: Hanami::Welcome Private

Inherits:
Object
  • Object
show all
Defined in:
lib/hanami/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.

Since:

  • 0.1.0

Instance Method Summary collapse

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.

Since:

  • 0.1.0



10
11
12
# File 'lib/hanami/welcome.rb', line 10

def initialize(_app)
  @root = Pathname.new(__dir__).join('templates').realpath
end

Instance Method Details

#application_nameObject

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.

Since:

  • 0.1.0



24
25
26
# File 'lib/hanami/welcome.rb', line 24

def application_name
  application_class.app_name
end

#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.

Since:

  • 0.1.0



15
16
17
18
19
20
21
# File 'lib/hanami/welcome.rb', line 15

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