Class: Hanami::Components::App::View Private

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

hanami-view configuration for a sigle Hanami application in the project.

Since:

  • 0.9.0

Class Method Summary collapse

Class Method Details

.resolve(app) ⇒ 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.

Configure hanami-view for a single Hanami application in the project.

rubocop:disable Metrics/AbcSize rubocop:disable Metrics/MethodLength

Parameters:

Since:

  • 0.9.0



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/hanami/components/app/view.rb', line 22

def self.resolve(app)
  config    = app.configuration
  namespace = app.namespace

  unless namespace.const_defined?('View', false)
    view = Hanami::View.duplicate(namespace) do
      root   config.templates
      layout config.layout

      config.view.__apply(self)
    end

    namespace.const_set('View', view)
  end

  Components.resolved "#{app.app_name}.view", namespace.const_get('View').configuration
end