module Rackal
Public Class Methods
Retrieves application details. Requires `config/rackal.yml`.
@return [Object] an object
# File lib/rackal.rb, line 49 def self.application @application ||= Internal::Application.new end
Retrieves database connection parameters from configuration file Requires `config/database.yml`.
@param [Hash] options @option options [true, false] :reset If true, resets cache and ensure fresh retrieval (defaults to: false) @return [Hash]
# File lib/rackal.rb, line 25 def self.database_parameters(options = {}) reload = options.delete(:reload) || false @database_parameters = nil if reload @database_parameters ||= Internal::DatabaseConfiguration.parameters end
Retrieves OS environment values (`ENV`)
@param [Hash] options @option options [true, false] :reset If true, resets cache and ensure fresh retrieval (defaults to: false) @return [String]
# File lib/rackal.rb, line 37 def self.env(key, options = {}) reload = options.delete(:reload) || false @env = nil if reload @env ||= {} @env[key] || (@env[key] = ENV.fetch(key.to_s, nil)) end
Retrieves current Rack environment with convenience methods
@param [Hash] options @option options [true, false] :reset If true, resets cache and ensure fresh retrieval (defaults to: false) @return [Object] an object
# File lib/rackal.rb, line 12 def self.environment(options = {}) reload = options.delete(:reload) || false @environment = nil if reload @environment = Internal::RackEnvironment.new(options) end
Applies Refrigerator gem (if available) in protected Rack environments
@return [true, false] true if gem available and in protected environment; otherwise, false
# File lib/rackal.rb, line 56 def self.protect! Internal::Protection.apply end
Returns root directory (inferred) for the application. Requires `config/rackal.yml`.
@return [String] top (root) directory for the application
# File lib/rackal.rb, line 63 def self.root @root ||= application.root end