Class: Hanami::Config::Views

Inherits:
Object
  • Object
show all
Includes:
Dry::Configurable
Defined in:
lib/hanami/config/views.rb

Overview

Hanami views config

This exposes all the settings from the standalone ‘Hanami::View` class, pre-configured with sensible defaults for actions within a full Hanami app. It also provides additional settings for further integration of views with other full stack app components.

Since:

  • 2.1.0

Instance Method Summary collapse

Constructor Details

#initializeViews

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

Since:

  • 2.1.0



26
27
28
29
30
31
32
# File 'lib/hanami/config/views.rb', line 26

def initialize(*)
  super

  @base_config = Hanami::View.config.dup

  configure_defaults
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *args, &block) ⇒ Object (private)

Since:

  • 2.1.0



67
68
69
70
71
72
73
74
75
76
77
# File 'lib/hanami/config/views.rb', line 67

def method_missing(name, *args, &block)
  return super if NON_FORWARDABLE_METHODS.include?(name)

  if config.respond_to?(name)
    config.public_send(name, *args, &block)
  elsif base_config.respond_to?(name)
    base_config.public_send(name, *args, &block)
  else
    super
  end
end

Instance Method Details

#finalize!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:

  • 2.1.0



44
45
46
47
48
49
50
# File 'lib/hanami/config/views.rb', line 44

def finalize!
  return self if frozen?

  base_config.finalize!

  super
end