Class: Ramverk::Configuration

Inherits:
Object
  • Object
show all
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

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Ramverk::Configuration::DynamicGroups

Instance Attribute Details

#appsHash (readonly)

Mounted applications.

Returns:

  • (Hash)


89
90
91
# File 'lib/ramverk/configuration.rb', line 89

def apps
  @apps
end

#autoload_eager_loadBoolean

Eager loads all files in the root of the #autoload_paths directories, recursively.

Disabled by default in development and test environments.

Returns:

  • (Boolean)


66
67
68
# File 'lib/ramverk/configuration.rb', line 66

def autoload_eager_load
  @autoload_eager_load
end

#autoload_loaderZeitwerk::Loader (readonly)

Autoloader object.

Returns:

  • (Zeitwerk::Loader)


52
53
54
# File 'lib/ramverk/configuration.rb', line 52

def autoload_loader
  @autoload_loader
end

#autoload_pathsArray

Paths to (re)load constants from. All paths should be relative to project root path.

Returns:

  • (Array)


58
59
60
# File 'lib/ramverk/configuration.rb', line 58

def autoload_paths
  @autoload_paths
end

#autoload_reloadBoolean

Reload constants automatically. This is only enabled in development by default.

Enabled by default in development environment.

Returns:

  • (Boolean)


74
75
76
# File 'lib/ramverk/configuration.rb', line 74

def autoload_reload
  @autoload_reload
end

#loggerLogger

Project logger.

Returns:

  • (Logger)


32
33
34
# File 'lib/ramverk/configuration.rb', line 32

def logger
  @logger
end

#logger_filter_paramsArray<String>

Params to be [FILTERED] out from logs.

Returns:



47
48
49
# File 'lib/ramverk/configuration.rb', line 47

def logger_filter_params
  @logger_filter_params
end

#logger_formatterProc

Logger formatter.

Returns:

  • (Proc)


42
43
44
# File 'lib/ramverk/configuration.rb', line 42

def logger_formatter
  @logger_formatter
end

#logger_levelSymbol

Logger severity level.

Returns:

  • (Symbol)


37
38
39
# File 'lib/ramverk/configuration.rb', line 37

def logger_level
  @logger_level
end

#middlewareRamverk::Middleware (readonly)

Middleware manager.

Returns:

See Also:



27
28
29
# File 'lib/ramverk/configuration.rb', line 27

def middleware
  @middleware
end

#public_directoryString

Public directory folder.

Returns:



79
80
81
# File 'lib/ramverk/configuration.rb', line 79

def public_directory
  @public_directory
end

#rootPathname

Project root path.

Returns:

  • (Pathname)


20
21
22
# File 'lib/ramverk/configuration.rb', line 20

def root
  @root
end

#serve_static_filesBoolean

Serve static files.

Returns:

  • (Boolean)


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.

Examples:

Ramverk.configure do |config|
  config.environment :development do
  end
end

Parameters:

  • env (Symbol)

Yield Parameters:



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.

Parameters:

  • app (#call)

    Application to mount.

  • at (String)

    Path prefix to match.

  • as (Symbol)

    App identifier.

  • host (Regexp) (defaults to: nil)

    Match the given host pattern.



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