module ObjectifyConfig
Constants
- VERSION
Public Class Methods
configuration_files(*files)
click to toggle source
# File lib/objectify_config.rb, line 7 def configuration_files(*files) @configurations = files end
configuration_keys()
click to toggle source
# File lib/objectify_config.rb, line 24 def configuration_keys file_contents = YAML.load_file(CONFIG_FILE) file_contents.each_with_object({}) do |(h,k), result| result[h.to_sym] = k end end
klass_name_for(config_file)
click to toggle source
# File lib/objectify_config.rb, line 38 def klass_name_for(config_file) "#{Pathname.new(config_file).basename.to_s.split('.')[0].camelize}Config" end
method_missing(key)
click to toggle source
# File lib/objectify_config.rb, line 20 def method_missing(key) configuration_keys[key.to_sym] end
run()
click to toggle source
# File lib/objectify_config.rb, line 11 def run @configurations.flatten.each do |config_file| config_klass_name = klass_name_for(config_file) temp_class = Class.new do singleton_class.class_eval do Object.const_set("CONFIG_FILE", config_file) def method_missing(key) configuration_keys[key.to_sym] end def configuration_keys file_contents = YAML.load_file(CONFIG_FILE) file_contents.each_with_object({}) do |(h,k), result| result[h.to_sym] = k end end end end Object.const_set(config_klass_name, temp_class) end end