Sha256: b763af2ce0eb872b8d39c2a4fa15b1f5bf85c8c4dd847c31ebb1130d3a95cb54
Contents?: true
Size: 1.17 KB
Versions: 3
Compression:
Stored size: 1.17 KB
Contents
require 'yaml' # Read the .yml file containing the configuration values class Settings attr_reader :solr_url, :solrj_jar_dir, :solrj_queue_size, :solrj_num_threads, :log_level, :log_file def initialize(settings_group) yml = YAML.load_file('lib/config/settings.yml')[settings_group] @solr_url = yml["solr_url"] @solrj_jar_dir = yml["solrj_jar_dir"] @solrj_queue_size = yml["solrj_queue_size"] @solrj_num_threads = yml["solrj_num_threads"] @log_level = yml["log_level"] @log_file = yml["log_file"] end # @return the attributes of this class as a Hash def as_hash {:solr_url => @solr_url, :solrj_jar_dir => @solrj_jar_dir, :solrj_queue_size => @solrj_queue_size, :solrj_num_threads => @solrj_num_threads, :log_level => get_log_level, :log_file => @log_file } end def get_log_level case (@log_level) when "debug" logger_level = Logger::DEBUG when "warn" logger_level = Logger::WARN when "error" logger_level = Logger::ERROR when "fatal" logger_level = Logger::FATAL else logger_level = Logger::INFO end logger_level end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
solrj_wrapper-1.0.0 | lib/solrj_wrapper/settings.rb |
solrj_wrapper-0.0.2 | lib/solrj_wrapper/settings.rb |
solrj_wrapper-0.0.1 | lib/solrj_wrapper/settings.rb |