Module: Briefly::Rails::Config
- Defined in:
- lib/briefly/rails/config.rb
Overview
Configuration, paths and the application-wide singletons.
App = Briefly.define { use Briefly::Rails::Config }
App.c # => Rails.configuration
App.root # => Rails.root
error is the framework's handled-error reporter: App.error.report(e), App.error.handle { }.
config_for reads a per-environment YAML config on every call, forwarding any keyword (such as
env:) to ::Rails.application.config_for; it takes an argument and is therefore never memoized —
compose one that is with shortcut(:payments) { config_for(:payments) }.memoize.
Inside this file the framework is always ::Rails — bare Rails would resolve to the parent module.
Class Method Summary collapse
Class Method Details
.install(builder) ⇒ Briefly::Builder
22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/briefly/rails/config.rb', line 22 def install(builder) builder.shortcut(:config, :c) { ::Rails.configuration } builder.shortcut(:config_x, :x) { ::Rails.configuration.x } builder.shortcut(:root) { ::Rails.root } builder.shortcut(:cache) { ::Rails.cache } builder.shortcut(:logger, :log) { ::Rails.logger } builder.shortcut(:credentials, :cred) { ::Rails.application.credentials } builder.shortcut(:error) { ::Rails.error } builder.shortcut(:config_for) { |name, **opts| ::Rails.application.config_for(name, **opts) } builder end |