Class: Hanami::Config::Views
- Inherits:
-
Object
- Object
- Hanami::Config::Views
- 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.
Instance Attribute Summary collapse
-
#default_template_engine ⇒ Object
Sets or returns the default template engine to use for generated views.
Instance Method Summary collapse
- #finalize! ⇒ Object private
-
#initialize ⇒ Views
constructor
private
A new instance of Views.
Constructor Details
#initialize ⇒ Views
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.
43 44 45 46 47 48 49 |
# File 'lib/hanami/config/views.rb', line 43 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)
84 85 86 87 88 89 90 91 92 93 94 |
# File 'lib/hanami/config/views.rb', line 84 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 Attribute Details
#default_template_engine ⇒ Object
Sets or returns the default template engine to use for generated views.
Used by generators when no explicit template engine is specified.
Supports erb, haml, and slim.
Defaults to "erb".
34 |
# File 'lib/hanami/config/views.rb', line 34 setting :default_template_engine, default: "erb" |
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.
61 62 63 64 65 66 67 |
# File 'lib/hanami/config/views.rb', line 61 def finalize! return self if frozen? base_config.finalize! super end |