class EasyConf::Lookup::AbstractLookup
Attributes
placeholder[W]
Public Class Methods
placeholder()
click to toggle source
# File lib/easy_conf/lookup/abstract_lookup.rb, line 14 def placeholder @placeholder ||= self.to_s.split('::').last.downcase end
read(key)
click to toggle source
# File lib/easy_conf/lookup/abstract_lookup.rb, line 10 def read(key) raise_interface_error! end
Private Class Methods
apply_decoding(value)
click to toggle source
# File lib/easy_conf/lookup/abstract_lookup.rb, line 33 def apply_decoding(value) if lookup_config && lookup_config.decoder lookup_config.decoder.call(value) end end
apply_default_decoding(value)
click to toggle source
# File lib/easy_conf/lookup/abstract_lookup.rb, line 39 def apply_default_decoding(value) EasyConf.configuration.decoder.call(value) if EasyConf.configuration.decoder end
commit(raw_value)
click to toggle source
# File lib/easy_conf/lookup/abstract_lookup.rb, line 26 def commit(raw_value) throw( :config_found, apply_decoding(raw_value) || apply_default_decoding(raw_value) || raw_value ) end
lookup_config()
click to toggle source
# File lib/easy_conf/lookup/abstract_lookup.rb, line 43 def lookup_config EasyConf.configuration.send(placeholder) end
raise_interface_error!()
click to toggle source
# File lib/easy_conf/lookup/abstract_lookup.rb, line 19 def raise_interface_error! method_name = caller_locations(1, 1)[0].label error_message = "`#{method_name}` method should be implemented in `#{self.name}` class!" raise EasyConf::InterfaceError.new(error_message) end