Class: Hanami::Welcome

Inherits:
Object
  • Object
show all
Defined in:
lib/hanami/welcome.rb

Overview

Since:

  • 0.1.0

Instance Method Summary collapse

Constructor Details

#initialize(_app) ⇒ Welcome

Returns a new instance of Welcome

Since:

  • 0.1.0


8
9
10
# File 'lib/hanami/welcome.rb', line 8

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

Instance Method Details

#application_nameObject

Since:

  • 0.1.0


19
20
21
# File 'lib/hanami/welcome.rb', line 19

def application_name
  " #{ app }" if container?
end

#call(env) ⇒ Object

Since:

  • 0.1.0


12
13
14
15
16
17
# File 'lib/hanami/welcome.rb', line 12

def call(env)
  @request_path = env['REQUEST_PATH'] || ''
  @body = [ERB.new(@root.join('welcome.html.erb').read).result(binding)]

  [200, {}, @body]
end