Sha256: d9c23a5fe12ae06cf0e6a1fec00b5a4f511e0f865cfaf7ce10b80265f1a7e815

Contents?: true

Size: 1.19 KB

Versions: 19

Compression:

Stored size: 1.19 KB

Contents

module Hanami
  # @since 0.9.0
  # @api private
  module Components
    # @since 0.9.0
    # @api private
    module App
      # hanami-view configuration for a sigle Hanami application in the project.
      #
      # @since 0.9.0
      # @api private
      class View
        # Configure hanami-view for a single Hanami application in the project.
        #
        # @param app [Hanami::Configuration::App] a Hanami application
        #
        # @since 0.9.0
        # @api private
        #
        # rubocop:disable Metrics/AbcSize
        # rubocop:disable Metrics/MethodLength
        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
      end
      # rubocop:enable Metrics/MethodLength
      # rubocop:enable Metrics/AbcSize
    end
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
hanami-1.3.3 lib/hanami/components/app/view.rb
hanami-1.3.2 lib/hanami/components/app/view.rb
hanami-1.3.1 lib/hanami/components/app/view.rb
hanami-1.3.0 lib/hanami/components/app/view.rb
hanami-1.3.0.beta1 lib/hanami/components/app/view.rb
hanami-1.2.0 lib/hanami/components/app/view.rb
hanami-1.2.0.rc2 lib/hanami/components/app/view.rb
hanami-1.2.0.rc1 lib/hanami/components/app/view.rb
hanami-1.2.0.beta2 lib/hanami/components/app/view.rb
hanami-1.2.0.beta1 lib/hanami/components/app/view.rb
hanami-1.1.1 lib/hanami/components/app/view.rb
hanami-1.1.0 lib/hanami/components/app/view.rb
hanami-1.1.0.rc1 lib/hanami/components/app/view.rb
hanami-1.1.0.beta3 lib/hanami/components/app/view.rb
hanami-1.1.0.beta2 lib/hanami/components/app/view.rb
hanami-1.1.0.beta1 lib/hanami/components/app/view.rb
hanami-1.0.0 lib/hanami/components/app/view.rb
hanami-1.0.0.rc1 lib/hanami/components/app/view.rb
hanami-1.0.0.beta3 lib/hanami/components/app/view.rb