Class: Omnes::Configurable::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/omnes/configurable.rb

Overview

Class where readers and writers are defined

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfig

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Config.



26
27
28
29
# File 'lib/omnes/configurable.rb', line 26

def initialize
  @_mutex = Mutex.new
  @settings = {}
end

Instance Attribute Details

#settingsObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



23
24
25
# File 'lib/omnes/configurable.rb', line 23

def settings
  @settings
end

Instance Method Details

#add_nesting(constant, name = default_nesting_name(constant)) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



41
42
43
44
45
# File 'lib/omnes/configurable.rb', line 41

def add_nesting(constant, name = default_nesting_name(constant))
  @_mutex.synchronize do
    define_nesting_reader(constant, name)
  end
end

#add_setting(name, default) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



32
33
34
35
36
37
38
# File 'lib/omnes/configurable.rb', line 32

def add_setting(name, default)
  @_mutex.synchronize do
    @settings[name] = default
    define_setting_reader(name)
    define_setting_writter(name)
  end
end