Class: BradyW::Config

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/config.rb

Overview

Using the bwbuildconfig GEM, does a singleton fetch of properties from the YAML config files

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(defaultfile = "local_properties_default.rb", userfile = "local_properties.rb") ⇒ Config

Returns a new instance of Config.



10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/config.rb', line 10

def initialize(defaultfile = "local_properties_default.rb",
               userfile = "local_properties.rb")
  puts "Using props file #{defaultfile} for default values"
  require defaultfile
  begin
    puts "Attempting to use props file #{userfile} for user/environment values"
    require userfile
  rescue LoadError
    puts "No user config file available"
  end
  configclass = BaseConfig.subclasses[-1]
  puts "Using configuration class: #{configclass.name}"
  @values = configclass.new
end

Instance Attribute Details

#valuesObject

Returns the value of attribute values.



8
9
10
# File 'lib/config.rb', line 8

def values
  @values
end