class Hanami::Config::Assets

Hanami assets config

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

@since 2.1.0 @api public

Attributes

base_config[R]

@api private

Public Class Methods

new(*, **options) click to toggle source

@api private

Calls superclass method
# File lib/hanami/config/assets.rb, line 43
def initialize(*, **options)
  super()

  @base_config = Hanami::Assets::Config.new(**options)

  configure_defaults
end

Private Instance Methods

configure_defaults() click to toggle source
# File lib/hanami/config/assets.rb, line 60
def configure_defaults
  self.serve =
    if ENV.key?("HANAMI_SERVE_ASSETS")
      ENV["HANAMI_SERVE_ASSETS"] == "true"
    else
      Hanami.env?(:development, :test)
    end
end
initialize_copy(source) click to toggle source

@api private

Calls superclass method
# File lib/hanami/config/assets.rb, line 52
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/assets.rb, line 69
def method_missing(name, *args, &block)
  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/assets.rb, line 79
def respond_to_missing?(name, _include_all = false)
  config.respond_to?(name) || base_config.respond_to?(name) || super
end