Module: EacRubyUtils::SettingsProvider

Defined in:
lib/eac_ruby_utils/settings_provider.rb,
lib/eac_ruby_utils/settings_provider/setting_value.rb

Overview

Provide a option by constant, method or options object.

Defined Under Namespace

Classes: SettingValue

Instance Method Summary collapse

Instance Method Details

#setting_constant_name(key, fullname = false) ⇒ Object


10
11
12
# File 'lib/eac_ruby_utils/settings_provider.rb', line 10

def setting_constant_name(key, fullname = false)
  setting_value_instance(key).constant_name(fullname)
end

#setting_search_orderObject


14
15
16
# File 'lib/eac_ruby_utils/settings_provider.rb', line 14

def setting_search_order
  %w[settings_object method constant]
end

#setting_value(key, options = {}) ⇒ Object


26
27
28
# File 'lib/eac_ruby_utils/settings_provider.rb', line 26

def setting_value(key, options = {})
  setting_value_instance(key, options).value
end

#setting_value_by_constant(key) ⇒ Object


30
31
32
# File 'lib/eac_ruby_utils/settings_provider.rb', line 30

def setting_value_by_constant(key)
  setting_value_instance(key).value_by_constant
end

#setting_value_by_method(key) ⇒ Object


34
35
36
# File 'lib/eac_ruby_utils/settings_provider.rb', line 34

def setting_value_by_method(key)
  setting_value_instance(key).value_by_method
end

#setting_value_by_settings_object(key) ⇒ Object


38
39
40
# File 'lib/eac_ruby_utils/settings_provider.rb', line 38

def setting_value_by_settings_object(key)
  setting_value_instance(key).value_by_settings_object
end

#setting_value_instance(key, options = {}) ⇒ Object


42
43
44
# File 'lib/eac_ruby_utils/settings_provider.rb', line 42

def setting_value_instance(key, options = {})
  ::EacRubyUtils::SettingsProvider::SettingValue.new(self, key, options)
end

#settings_objectObject


18
19
20
# File 'lib/eac_ruby_utils/settings_provider.rb', line 18

def settings_object
  respond_to?(settings_object_name) ? send(settings_object_name) : {}
end

#settings_object_nameObject


22
23
24
# File 'lib/eac_ruby_utils/settings_provider.rb', line 22

def settings_object_name
  'settings'
end