Class: Wildsight::Agent::Config
- Inherits:
-
Object
- Object
- Wildsight::Agent::Config
- Defined in:
- lib/wildsight/agent/config.rb
Class Method Summary collapse
Instance Method Summary collapse
- #[](name) ⇒ Object
-
#initialize(values = {}) ⇒ Config
constructor
A new instance of Config.
- #method_missing(name, *args) ⇒ Object
Constructor Details
#initialize(values = {}) ⇒ Config
Returns a new instance of Config.
17 18 19 |
# File 'lib/wildsight/agent/config.rb', line 17 def initialize(values = {}) @values = values end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args) ⇒ Object
21 22 23 24 |
# File 'lib/wildsight/agent/config.rb', line 21 def method_missing(name, *args) name = name.to_s self[name] end |
Class Method Details
.load(file = (ENV['WILDSIGHT_CONFIG_FILE'] || 'config/wildsight.yml')) ⇒ Object
8 9 10 11 12 13 14 15 |
# File 'lib/wildsight/agent/config.rb', line 8 def self.load(file = (ENV['WILDSIGHT_CONFIG_FILE'] || 'config/wildsight.yml')) = YAML.load(File.read(File.('../config.yml', __FILE__))) = .merge(file) if file.kind_of?(Hash) if file.kind_of?(String) && File.exist?(file) = .merge(YAML.load(File.read(file))) end Config.new() end |