class Hanami::Config::Views

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 @api public

Constants

NON_FORWARDABLE_METHODS

An inflector for views is not configurable via ‘config.views.inflector` on an `Hanami::App`. The app-wide inflector is already configurable there as `config.inflector` and will be used as the default inflector for views.

A custom inflector may still be provided in an ‘Hanami::View` subclass, via `config.inflector=`.

Attributes

base_config[R]

@api private @since 2.1.0

Public Class Methods

new(*) click to toggle source

@api private @since 2.1.0

Calls superclass method
# File lib/hanami/config/views.rb, line 26
def initialize(*)
  super

  @base_config = Hanami::View.config.dup

  configure_defaults
end

Public Instance Methods

finalize!() click to toggle source

@api private @since 2.1.0

Calls superclass method
# File lib/hanami/config/views.rb, line 44
def finalize!
  return self if frozen?

  base_config.finalize!

  super
end

Private Instance Methods

configure_defaults() click to toggle source
# File lib/hanami/config/views.rb, line 54
def configure_defaults
  self.layout = "app"
end
initialize_copy(source) click to toggle source

@api private @since 2.1.0

Calls superclass method
# File lib/hanami/config/views.rb, line 36
def initialize_copy(source)
  super
  @base_config = source.base_config.dup
end
method_missing(name, *args, &block) click to toggle source
Calls superclass method
# 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
respond_to_missing?(name, _include_all = false) click to toggle source
Calls superclass method
# File lib/hanami/config/views.rb, line 79
def respond_to_missing?(name, _include_all = false)
  return false if NON_FORWARDABLE_METHODS.include?(name)

  config.respond_to?(name) || base_config.respond_to?(name) || super
end