class RemoveAccents::Configuration
Public Class Methods
config()
click to toggle source
# File lib/remove_accents/configuration.rb, line 58 def self.config @config end
configure(opts = {})
click to toggle source
Configure through hash
# File lib/remove_accents/configuration.rb, line 34 def self.configure(opts = {}) opts.each {|k,v| @config[k.to_s] = v if @valid_config_keys.include? k.to_s} end
configure_with_path()
click to toggle source
Configure through yaml file
# File lib/remove_accents/configuration.rb, line 39 def self.configure_with_path if defined?(::Rails).nil? path_to_yaml_file = "../config/remove_accents.yml" else path_to_yaml_file = "#{::Rails.root}/config/remove_accents.yml" end begin config = YAML::load(IO.read(path_to_yaml_file)) rescue Errno::ENOENT #puts "YAML configuration file couldn't be found. Using defaults." return rescue Psych::SyntaxError puts "YAML configuration file contains invalid syntax. Using defaults." return end configure(config) end