Module: Sinclair::ChainSettable

Extended by:
Settable::ClassMethods
Includes:
Settable
Defined in:
lib/sinclair/chain_settable.rb

Overview

Settable that recovers data from other settables

Each setting obeys a settable order and when a setting value is not found, the next is checked

Author:

  • darthjee

Instance Method Summary collapse

Methods included from Settable::ClassMethods

read_with

Methods included from Settable

#settable_module, #setting_with_options, #with_settings

Instance Method Details

#source(key, source) ⇒ Class<Settable>

Register a setting source

Parameters:

  • key (Symbol)

    key identifying the setting

  • source (Class<Settable>)

    Setting source class

Returns:



33
34
35
# File 'lib/sinclair/chain_settable.rb', line 33

def source(key, source)
  sources_map[key] = source
end

#sources(*sources) ⇒ Array<Symbol>

Defines the order of the settings

Parameters:

  • sources (Array<Symbol>)

    lis of sources in order

Returns:

  • (Array<Symbol>)


46
47
48
# File 'lib/sinclair/chain_settable.rb', line 46

def sources(*sources)
  @sources = sources
end