Class: Convergence::Config
- Inherits:
-
Object
- Object
- Convergence::Config
- Defined in:
- lib/convergence/config.rb
Constant Summary collapse
- ATTRIBUTES =
%i[adapter database host port username password].freeze
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(attributes) ⇒ Config
constructor
A new instance of Config.
Constructor Details
#initialize(attributes) ⇒ Config
Returns a new instance of Config.
9 10 11 12 13 14 15 |
# File 'lib/convergence/config.rb', line 9 def initialize(attributes) attributes.each do |k, v| next if v.nil? next if !ATTRIBUTES.include?(k.to_sym) && !ATTRIBUTES.include?(k.to_s) instance_variable_set("@#{k}", v) end end |
Class Method Details
.load(yaml_path) ⇒ Object
17 18 19 20 |
# File 'lib/convergence/config.rb', line 17 def self.load(yaml_path) setting = YAML.safe_load(ERB.new(File.read(yaml_path)).result, [], [], true) new(setting) end |