Class: Ramverk::Configuration
- Inherits:
-
Object
- Object
- Ramverk::Configuration
- Includes:
- DynamicGroups
- Defined in:
- lib/ramverk/configuration.rb,
lib/ramverk/configuration/middleware.rb,
lib/ramverk/configuration/dynamic_groups.rb
Overview
Project configuration.
Defined Under Namespace
Modules: DynamicGroups Classes: Middleware
Instance Attribute Summary collapse
-
#apps ⇒ Hash
readonly
Mounted applications.
-
#autoload_eager_load ⇒ Boolean
Eager loads all files in the root of the #autoload_paths directories, recursively.
-
#autoload_loader ⇒ Zeitwerk::Loader
readonly
Autoloader object.
-
#autoload_paths ⇒ Array
Paths to (re)load constants from.
-
#autoload_reload ⇒ Boolean
Reload constants automatically.
-
#logger ⇒ Logger
Project logger.
-
#logger_filter_params ⇒ Array<String>
Params to be [FILTERED] out from logs.
-
#logger_formatter ⇒ Proc
Logger formatter.
-
#logger_level ⇒ Symbol
Logger severity level.
-
#middleware ⇒ Ramverk::Middleware
readonly
Middleware manager.
-
#public_directory ⇒ String
Public directory folder.
-
#root ⇒ Pathname
Project root path.
-
#serve_static_files ⇒ Boolean
Serve static files.
Instance Method Summary collapse
-
#environment(env) {|config| ... } ⇒ Object
Yield the block if the given environment matches the current.
-
#mount(app, at:, as:, host: nil) ⇒ Object
Mount a Rack compatible at the given path prefix.
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Ramverk::Configuration::DynamicGroups
Instance Attribute Details
#apps ⇒ Hash (readonly)
Mounted applications.
89 90 91 |
# File 'lib/ramverk/configuration.rb', line 89 def apps @apps end |
#autoload_eager_load ⇒ Boolean
Eager loads all files in the root of the #autoload_paths directories, recursively.
Disabled by default in development
and test
environments.
66 67 68 |
# File 'lib/ramverk/configuration.rb', line 66 def autoload_eager_load @autoload_eager_load end |
#autoload_loader ⇒ Zeitwerk::Loader (readonly)
Autoloader object.
52 53 54 |
# File 'lib/ramverk/configuration.rb', line 52 def autoload_loader @autoload_loader end |
#autoload_paths ⇒ Array
Paths to (re)load constants from. All paths should be relative to project root path.
58 59 60 |
# File 'lib/ramverk/configuration.rb', line 58 def autoload_paths @autoload_paths end |
#autoload_reload ⇒ Boolean
Reload constants automatically. This is only enabled in development
by
default.
Enabled by default in development
environment.
74 75 76 |
# File 'lib/ramverk/configuration.rb', line 74 def autoload_reload @autoload_reload end |
#logger ⇒ Logger
Project logger.
32 33 34 |
# File 'lib/ramverk/configuration.rb', line 32 def logger @logger end |
#logger_filter_params ⇒ Array<String>
Params to be [FILTERED] out from logs.
47 48 49 |
# File 'lib/ramverk/configuration.rb', line 47 def logger_filter_params @logger_filter_params end |
#logger_formatter ⇒ Proc
Logger formatter.
42 43 44 |
# File 'lib/ramverk/configuration.rb', line 42 def logger_formatter @logger_formatter end |
#logger_level ⇒ Symbol
Logger severity level.
37 38 39 |
# File 'lib/ramverk/configuration.rb', line 37 def logger_level @logger_level end |
#middleware ⇒ Ramverk::Middleware (readonly)
Middleware manager.
27 28 29 |
# File 'lib/ramverk/configuration.rb', line 27 def middleware @middleware end |
#public_directory ⇒ String
Public directory folder.
79 80 81 |
# File 'lib/ramverk/configuration.rb', line 79 def public_directory @public_directory end |
#root ⇒ Pathname
Project root path.
20 21 22 |
# File 'lib/ramverk/configuration.rb', line 20 def root @root end |
#serve_static_files ⇒ Boolean
Serve static files.
84 85 86 |
# File 'lib/ramverk/configuration.rb', line 84 def serve_static_files @serve_static_files end |
Instance Method Details
#environment(env) {|config| ... } ⇒ Object
Yield the block if the given environment matches the current.
140 141 142 |
# File 'lib/ramverk/configuration.rb', line 140 def environment(env) yield self if env == @env end |
#mount(app, at:, as:, host: nil) ⇒ Object
Mount a Rack compatible at the given path prefix.
126 127 128 |
# File 'lib/ramverk/configuration.rb', line 126 def mount(app, at:, as:, host: nil) @apps[as] = [app, Mustermann.new(at), host].freeze end |