Module: Assent::Config
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.add(option, value) ⇒ Object
28 29 30 |
# File 'lib/assent/config/config.rb', line 28 def self.add(option, value) config[option] = value end |
.config ⇒ Object
32 33 34 |
# File 'lib/assent/config/config.rb', line 32 def self.config @@config ||= Hash.new end |
.config_file(path) ⇒ Object
17 18 19 20 21 22 23 24 25 26 |
# File 'lib/assent/config/config.rb', line 17 def self.config_file(path) begin lang = YAML.load_file(path) lang.each do |key, value| add(key, value) end rescue Errno::ENOENT raise ConfigException.new "Config file could not be found." end end |
Instance Method Details
#initialize ⇒ Object
7 8 9 10 11 12 13 14 15 |
# File 'lib/assent/config/config.rb', line 7 def initialize if Config.config.empty? lang = YAML.load_file(File.dirname(__FILE__) + '/lang.yml') lang.each do |key, value| Config.add(key, value) end end end |