module Configuration

Public Class Methods

config() click to toggle source
# File lib/accesible_uy/configuration.rb, line 5
def config
  load_file(Rails.root.join('config', 'accesible_uy.yml')) if @config.empty?

  @config
end
configure(opts = {}) click to toggle source
# File lib/accesible_uy/configuration.rb, line 11
def configure(opts = {})
  opts.each do |key, value|
    @config[key] = value if @valid_config_keys.include? key
  end
end
load_file(path_to_yaml_file) click to toggle source
# File lib/accesible_uy/configuration.rb, line 17
def load_file(path_to_yaml_file)
  begin
    config = YAML.load(IO.read(path_to_yaml_file))[Rails.env]
  rescue => exception
    raise "YAML configuration file couldn't be found: #{ exception }"
  end
  configure(config)
end

Private Instance Methods

config() click to toggle source
# File lib/accesible_uy/configuration.rb, line 5
def config
  load_file(Rails.root.join('config', 'accesible_uy.yml')) if @config.empty?

  @config
end
configure(opts = {}) click to toggle source
# File lib/accesible_uy/configuration.rb, line 11
def configure(opts = {})
  opts.each do |key, value|
    @config[key] = value if @valid_config_keys.include? key
  end
end
load_file(path_to_yaml_file) click to toggle source
# File lib/accesible_uy/configuration.rb, line 17
def load_file(path_to_yaml_file)
  begin
    config = YAML.load(IO.read(path_to_yaml_file))[Rails.env]
  rescue => exception
    raise "YAML configuration file couldn't be found: #{ exception }"
  end
  configure(config)
end