module Assent::Config

Public Class Methods

add(option, value) click to toggle source
# File lib/assent/config/config.rb, line 28
def self.add(option, value)
  config[option] = value
end
config() click to toggle source
# File lib/assent/config/config.rb, line 32
def self.config
  @@config ||= Hash.new
end
config_file(path) click to toggle source
# 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
new() click to toggle source
# 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

Private Instance Methods

set_empty_config() click to toggle source
# File lib/assent/config/config.rb, line 38
def set_empty_config
  @@config = Hash.new
end