lib/app_configuration/config.rb in app_configuration-0.0.2 vs lib/app_configuration/config.rb in app_configuration-0.0.3

- old
+ new

@@ -7,11 +7,11 @@ optional_attr :config_file_name, default: '.config.yml' optional_attr :base_local_path, default: './' optional_attr :base_global_path, default: '~/' optional_attr :use_env_variables, default: true - optional_attr :prefix + optional_attr :prefix # Class Methods class << self @@ -25,21 +25,21 @@ end # Instance Methods - def initialize(config_file_name, &block) + def initialize(config_file_name = nil, &block) super() # Sets default values for optional attributes - @config_file_name = config_file_name + @config_file_name = config_file_name if config_file_name self.instance_eval(&block) if block_given? end - def local_config_path + def local_config_path @local_config_path ||= config_path(@base_local_path) end - def global_config_path + def global_config_path @global_config_path ||= config_path(@base_global_path) end def [](name) env_name = '' @@ -70,6 +70,6 @@ def config_path(base_path) File.expand_path(File.join(base_path, @config_file_name)) end end -end \ No newline at end of file +end