Sha256: 14c2d279e472f7cade397c8af56c69d2643f24ae1347d7f7c24b63257a3b57a2

Contents?: true

Size: 604 Bytes

Versions: 4

Compression:

Stored size: 604 Bytes

Contents

require 'erb'
require 'pathname'
require 'lotus/environment'
require 'lotus/utils/string'

module Lotus
  class Welcome
    def initialize(app)
      @root = Pathname.new(__dir__).join('templates').realpath
      @body = [ERB.new(@root.join('welcome.html.erb').read).result(binding)]
    end

    def call(env)
      [200, {}, @body]
    end

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

    private

    def container?
      Environment.new.container?
    end

    def app
      Utils::String.new(
        Application.applications.first
      ).namespace.downcase
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
lotusrb-0.6.0 lib/lotus/welcome.rb
lotusrb-0.5.0 lib/lotus/welcome.rb
lotusrb-0.4.1 lib/lotus/welcome.rb
lotusrb-0.4.0 lib/lotus/welcome.rb