Class: RightConf::ConfiguratorRegistry

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/rconf/configurator_registry.rb

Overview

Configurator mixin, defines DSL and common validation method

Instance Method Summary collapse

Methods included from Singleton

included

Instance Method Details

#[](key) ⇒ Object

Configurator class for given key

Parameters

key(String)

Configurator for given key

Return

cfg_class(Constant)

Configurator class if there is one

nil

Otherwise



39
40
41
# File 'lib/rconf/configurator_registry.rb', line 39

def [](key)
  @configurators[key]
end

#[]=(key, value) ⇒ Object

Associate configurator with given key

Parameters

key(Symbol)

Key configurator should be associated with

value(Class)

Associated configurator class

Return

value(Class)

Configurator class



27
28
29
# File 'lib/rconf/configurator_registry.rb', line 27

def []=(key, value)
  @configurators[key] = value
end

#each(&blk) ⇒ Object

Iterate through all configurators

Block

Block should take one argument which is the configurator being iterated on

Return

true

Always return true



50
51
52
53
# File 'lib/rconf/configurator_registry.rb', line 50

def each(&blk)
  @configurators.each(&blk)
  true
end