Class: BackgroundQueue::Config
- Inherits:
-
Object
- Object
- BackgroundQueue::Config
- Defined in:
- lib/background_queue/config.rb
Overview
Base class that loads configuration files for client/server
Direct Known Subclasses
Constant Summary collapse
- DEFAULT_PORT =
the default port that is used if the configuration does not specify a port
2222
Class Method Summary collapse
-
.load_file(path) ⇒ Object
load the configuration using a file path.
-
.load_hash(env_config, path) ⇒ Object
load the configration using a hash just containing the environment.
-
.load_string(string, path) ⇒ Object
load the configuration using a string that may contain ERB syntax.
-
.load_yaml(yaml_string, path) ⇒ Object
load the configuration using a string of YAML.
Class Method Details
.load_file(path) ⇒ Object
load the configuration using a file path
13 14 15 16 |
# File 'lib/background_queue/config.rb', line 13 def self.load_file(path) string = get_string_from_file(path) load_string(string, path) end |
.load_hash(env_config, path) ⇒ Object
load the configration using a hash just containing the environment. Overridden by Client/Server class.
32 33 34 |
# File 'lib/background_queue/config.rb', line 32 def self.load_hash(env_config, path) raise "Invalid Loading of Ciguration using abstract base class. Use Server or Client subclass." end |
.load_string(string, path) ⇒ Object
load the configuration using a string that may contain ERB syntax
19 20 21 22 |
# File 'lib/background_queue/config.rb', line 19 def self.load_string(string, path) evaled_string = evaluate_erb(string, path) load_yaml(evaled_string, path) end |
.load_yaml(yaml_string, path) ⇒ Object
load the configuration using a string of YAML
25 26 27 28 29 |
# File 'lib/background_queue/config.rb', line 25 def self.load_yaml(yaml_string, path) all_configs = convert_yaml_to_hash(yaml_string, path) env_config = extract_enviroment_entry(all_configs, path) load_hash(env_config, path) end |