Module: Omnes::Configurable

Overview

Ad-hoc configurable behavior for Omnes

Example:

Omnes.configure do |config|
  config.event.name_builder = MY_NAME_BUILDER
end

or

Omnes::Event.config.name_builder = MY_NAME_BUILDER

Defined Under Namespace

Classes: Config

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.extended(klass) ⇒ 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.



67
68
69
# File 'lib/omnes/configurable.rb', line 67

def self.extended(klass)
  klass.instance_variable_set(:@config, Config.new)
end

Instance Method Details

#configConfigurable::Config

Returns the configuration class

Use this class to access readers and writers for the defined settings or nested configurations



77
78
79
# File 'lib/omnes/configurable.rb', line 77

def config
  @config
end

#configure {|@config| ... } ⇒ Object

Yields the configuration class

Yields:

See Also:



84
85
86
# File 'lib/omnes/configurable.rb', line 84

def configure
  yield @config
end

#nest_config(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.



94
95
96
# File 'lib/omnes/configurable.rb', line 94

def nest_config(constant, name: default_nesting_name(constant))
  config.add_nesting(constant, name)
end

#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.



89
90
91
# File 'lib/omnes/configurable.rb', line 89

def setting(name, default:)
  config.add_setting(name, default)
end