Class: Racket::Settings::Application

Inherits:
Base
  • Object
show all
Defined in:
lib/racket/settings/application.rb

Overview

Class for storing application settings.

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

default_value, #delete, #fetch, #present?, setting, #store

Constructor Details

#initialize(utils, defaults = {}) ⇒ Application

Returns a new instance of Application.



42
43
44
45
# File 'lib/racket/settings/application.rb', line 42

def initialize(utils, defaults = {})
  @utils = utils
  super(defaults)
end

Class Method Details

.directory_setting(symbol, directory) ⇒ nil

Creates a directory setting with a default value.

Parameters:

  • symbol (Symbol)
  • directory (String)

Returns:

  • (nil)


52
53
54
55
# File 'lib/racket/settings/application.rb', line 52

def self.directory_setting(symbol, directory)
  define_directory_method(symbol, "@#{symbol}".to_sym, directory)
  attr_writer(symbol) && nil
end

.service(options = {}) ⇒ Proc

Returns a service proc that can be used by the registry.

Parameters:

  • options (Hash) (defaults to: {})

Returns:

  • (Proc)


38
39
40
# File 'lib/racket/settings/application.rb', line 38

def self.service(options = {})
  ->(reg) { new(reg.utils, options) }
end